HighDots Forums  

Underlining urls in paragraphs only.

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Underlining urls in paragraphs only. in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Stoic
 
Posts: n/a

Default Underlining urls in paragraphs only. - 09-12-2004 , 11:26 PM






Hi, I'm relatively new to CSS. I'm trying to get all the urls in a group of text bracketed by
<p></p> tags to be underlined and everywhere else to NOT be underlined. As of now my code is
like this...

A {color: #003366; font-size: 14px; text-decoration: none;}

Which solves the second requirement but not the first. I don't want to have to put a style
reference in every <a> statement enclosed by a <p> on my site. There are many, many <p>'s.

Is this possible and how?

Thanks in advance.


Reply With Quote
  #2  
Old   
Nik Coughin
 
Posts: n/a

Default Re: Underlining urls in paragraphs only. - 09-12-2004 , 11:46 PM






Stoic wrote:
Quote:
Hi, I'm relatively new to CSS. I'm trying to get all the urls in a
group of text bracketed by <p></p> tags to be underlined and
everywhere else to NOT be underlined. As of now my code is like
this...

A {color: #003366; font-size: 14px; text-decoration: none;}

Which solves the second requirement but not the first. I don't want
to have to put a style reference in every <a> statement enclosed by a
p> on my site. There are many, many <p>'s.

Is this possible and how?

Thanks in advance.
a{ color: #003366; font-size: 14px; text-decoration: none; }
p a{ text-decoration: underline; }




Reply With Quote
  #3  
Old   
Neal
 
Posts: n/a

Default Re: Underlining urls in paragraphs only. - 09-12-2004 , 11:46 PM



On Mon, 13 Sep 2004 00:26:23 -0400, Stoic <nobody (AT) nowhere (DOT) com> wrote:

Quote:
Hi, I'm relatively new to CSS. I'm trying to get all the urls in a group
of text bracketed by
p></p> tags to be underlined and everywhere else to NOT be underlined.
As of now my code is
like this...

A {color: #003366; font-size: 14px; text-decoration: none;}

Which solves the second requirement but not the first. I don't want to
have to put a style
reference in every <a> statement enclosed by a <p> on my site. There are
many, many <p>'s.

Is this possible and how?

Thanks in advance.
a {text-decoration: none;}
p a {text-decoration: underline;}

But be sure any non-underlined links are obviously links. And don't use px
to set font-size, % is the only foolproof method.


Reply With Quote
  #4  
Old   
Stoic
 
Posts: n/a

Default Re: Underlining urls in paragraphs only. - 09-13-2004 , 02:22 PM



In article <opsd80wcqe6v6656 (AT) news (DOT) individual.net>, neal413 (AT) yahoo (DOT) com says...
Quote:
a {text-decoration: none;}
p a {text-decoration: underline;}

But be sure any non-underlined links are obviously links. And don't use px
to set font-size, % is the only foolproof method.

Thanks everyone. After I tried to apply the code, I realized I had a bigger problem than I
originally thought. Here's my solution...

A { color: #003366; font-size: 100%; text-decoration: none;}
A:link { color: #003366; text-decoration: none; }
A:visited { color: #003366; text-decoration: none; }
A:active { color: #999999; }
A:hover { color: red; background-color: #FFFFFF; }
p a { text-decoration: underline;}
p a:link { text-decoration: underline;}
p a:visited { text-decoration: underline;}
p a:active { text-decoration: underline;}
p a:hover { text-decoration: underline;}
h1, h2, h3 { margin: 0px; padding: 0px; }
li { list-style-position: outside; }
li a { text-decoration: underline;}
li a:link { text-decoration: underline;}
li a:visited { text-decoration: underline;}
li a:active { text-decoration: underline;}
li a:hover { text-decoration: underline;}
sup { font-size: 40%; font-family: sans-serif; font-weight: bold;
text-decoration: none;}


I also went through the entire stylesheet and changed all the px references to % for font-
size. Thanks.


Reply With Quote
  #5  
Old   
Neal
 
Posts: n/a

Default Re: Underlining urls in paragraphs only. - 09-13-2004 , 04:45 PM



On Mon, 13 Sep 2004 15:22:05 -0400, Stoic <nobody (AT) nowhere (DOT) com> wrote:

Quote:
A { color: #003366; font-size: 100%; text-decoration: none;}
A:link { color: #003366; text-decoration: none; }
A:visited { color: #003366; text-decoration: none; }
A:active { color: #999999; }
A:hover { color: red; background-color: #FFFFFF; }
If you set it for A, you should not have to set it for all the pseudos as
well. You should be able to safely remove some of the styles in the
pseudos which are identical to what you stated in the a declaration.


Reply With Quote
  #6  
Old   
Stoic
 
Posts: n/a

Default Re: Underlining urls in paragraphs only. - 09-13-2004 , 09:05 PM



In article <opseab2vz46v6656 (AT) news (DOT) individual.net>, neal413 (AT) yahoo (DOT) com says...
Quote:
On Mon, 13 Sep 2004 15:22:05 -0400, Stoic <nobody (AT) nowhere (DOT) com> wrote:

A { color: #003366; font-size: 100%; text-decoration: none;}
A:link { color: #003366; text-decoration: none; }
A:visited { color: #003366; text-decoration: none; }
A:active { color: #999999; }
A:hover { color: red; background-color: #FFFFFF; }

If you set it for A, you should not have to set it for all the pseudos as
well. You should be able to safely remove some of the styles in the
pseudos which are identical to what you stated in the a declaration.

Thanks, I think what you're saying is I can delete the A:link and A:visited because they are
identical to the A. Gotcha.


Reply With Quote
  #7  
Old   
Virginia Grieco
 
Posts: n/a

Default Re: CSS ID Class selectors - 09-14-2004 , 06:46 AM



Can anyone give me an example of what a Class ID selector would be used for?

I am fairly new to CSS, and I understand that ID selectors can only be used
once within a website.

Thanks for your help.

--




Ginny
Student



Reply With Quote
  #8  
Old   
Neal
 
Posts: n/a

Default Re: CSS ID Class selectors - 09-14-2004 , 07:59 AM



On Tue, 14 Sep 2004 11:46:39 GMT, Virginia Grieco <vgrieco (AT) optonline (DOT) net>
wrote:

Quote:
Can anyone give me an example of what a Class ID selector would be used
for?

I am fairly new to CSS, and I understand that ID selectors can only be
used
once within a website.
Well, that's not exactly true. An ID is used once within a webpage.
Important difference. I can put id="foo" once on every page in my site. In
fact, I could put it on different elements if I wanted.

A class, though, can be used over and over again. So if it's something
that could happen more than once on a page, use class.

Ids can also be used as linking points where class cannot.

Check out w3schools.com and their HTML + CSS tutorials for more detail.


Reply With Quote
  #9  
Old   
Harlan Messinger
 
Posts: n/a

Default Re: CSS ID Class selectors - 09-14-2004 , 10:43 AM




"Virginia Grieco" <vgrieco (AT) optonline (DOT) net> wrote

Quote:
Can anyone give me an example of what a Class ID selector would be used
for?

I am fairly new to CSS, and I understand that ID selectors can only be
used
once within a website.
In HTML, the value of an ID *attribute* must be unique within a web *page*.
This is independent of whether any styles are defined in CSS for a selector
that references a particular ID.

There are at least *three* reasons to specify an ID attribute for an element
on a web page:

1. As a hook for applying styles.

2. As a means of referencing elements in client-side code.

3. As a target for an internal hyperlink such as <a href="#thisplace">.

Suppose you have a set of styles that should apply to paragraphs, lists,
hyperlinks, and so forth, only within a footnote section that appears on
your web pages. Give an ID to the footnote section or whatever, and then use
selectors based on the ID.

p { /* usual properties you want on your web pages */ }
li { /* usual properties you want on your web pages */ }
a { /* usual properties you want on your web pages */ }

#footnotes p { /* properties you want to apply within your footnotes
section /* }
#footnotes li { /* properties you want to apply within your footnotes
section /* }
#footnotes a { /* properties you want to apply within your footnotes
section /* }

...
<div id="footnotes">
<!-- Footnotes go here -->
</div>



Reply With Quote
  #10  
Old   
Jan Roland Eriksson
 
Posts: n/a

Default Re: CSS ID Class selectors - 09-15-2004 , 04:55 AM



On Tue, 14 Sep 2004 11:43:46 -0400, "Harlan Messinger"
<h.messinger (AT) comcast (DOT) net> wrote:

Quote:
"Virginia Grieco" <vgrieco (AT) optonline (DOT) net> wrote in message
news:zSA1d.1594$4p6.1079777 (AT) news4 (DOT) srv.hcvlny.cv.net...
Can anyone give me an example of what a Class ID selector would be used
for?
[...]
In HTML, the value of an ID *attribute*...
Well; formally speaking ID is _not_ an element attribute...

--
Rex




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.