473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Underlining urls in paragraphs only.

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.

Jul 20 '05 #1
16 1962
Stoic wrote:
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; }
Jul 20 '05 #2
On Mon, 13 Sep 2004 00:26:23 -0400, Stoic <no****@nowhere.com> wrote:
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.
Jul 20 '05 #3
In article <op**************@news.individual.net>, ne*****@yahoo.com says...

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.
Jul 20 '05 #4
On Mon, 13 Sep 2004 15:22:05 -0400, Stoic <no****@nowhere.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.
Jul 20 '05 #5
In article <op**************@news.individual.net>, ne*****@yahoo.com says...
On Mon, 13 Sep 2004 15:22:05 -0400, Stoic <no****@nowhere.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.
Jul 20 '05 #6
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
Jul 20 '05 #7
On Tue, 14 Sep 2004 11:46:39 GMT, Virginia Grieco <vg*****@optonline.net>
wrote:
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.
Jul 20 '05 #8

"Virginia Grieco" <vg*****@optonline.net> wrote in message
news:zS********************@news4.srv.hcvlny.cv.ne t...
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>

Jul 20 '05 #9
On Tue, 14 Sep 2004 11:43:46 -0400, "Harlan Messinger"
<h.*********@comcast.net> wrote:

"Virginia Grieco" <vg*****@optonline.net> wrote in message
news:zS********************@news4.srv.hcvlny.cv.n et...
Can anyone give me an example of what a Class ID selector would be usedfor?

[...]In HTML, the value of an ID *attribute*...


Well; formally speaking ID is _not_ an element attribute...

--
Rex
Jul 20 '05 #10
Jan Roland Eriksson <jr****@newsguy.com> wrote:
On Tue, 14 Sep 2004 11:43:46 -0400, "Harlan Messinger"
<h.*********@comcast.net> wrote:

"Virginia Grieco" <vg*****@optonline.net> wrote in message
news:zS********************@news4.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...


Why would you say that? Besides the fact that it has all the qualities
of an attribute, which ought to be sufficient basis for contradicting
you, the spec calls it an attribute, so how much more formally spoken
does it need to be?

http://www.w3.org/TR/html4/struct/global.html#h-7.5.2

"7.5.2 Element identifiers: the id and class attributes
Attribute definitions

id = name [CS]
This attribute assigns a name to an element. This name must be unique
in a document...."
--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 20 '05 #11
On Wed, 15 Sep 2004 09:30:54 -0400, Harlan Messinger
<hm*******************@comcast.net> wrote:
Jan Roland Eriksson <jr****@newsguy.com> wrote:
On Tue, 14 Sep 2004 11:43:46 -0400, "Harlan Messinger"
<h.*********@comcast.net> wrote:
In HTML, the value of an ID *attribute*...
Well; formally speaking ID is _not_ an element attribute...
Why would you say that?


Yea, that's a good question.

Allow me to switch on my brain before I continue to say that what I was
aiming at is the fact that there is a difference in what type of data
you can assign as a value for an ID as compared to most other
attributes.

An ID can only be assigned an ID value which in practice means that it
can only be a fully qualified SGML name starting with a valid name_start
character and optionally followed only by valid name_characters.

At the other side we have the vast majority of HTML element attributes
that takes on values that boils down to be of type CDATA. Very few HTML
attribute values can actually be checked for validity, if one wanted to
do that, since the attribute values are never parsed.

ID values otoh are always parsed.

--
Rex
Jul 20 '05 #12
Jan Roland Eriksson <jr****@newsguy.com> wrote:
On Wed, 15 Sep 2004 09:30:54 -0400, Harlan Messinger
<hm*******************@comcast.net> wrote:
Jan Roland Eriksson <jr****@newsguy.com> wrote:
On Tue, 14 Sep 2004 11:43:46 -0400, "Harlan Messinger"
<h.*********@comcast.net> wrote:In HTML, the value of an ID *attribute*...Well; formally speaking ID is _not_ an element attribute...

Why would you say that?


Yea, that's a good question.

Allow me to switch on my brain before I continue to say that what I was
aiming at is the fact that there is a difference in what type of data
you can assign as a value for an ID as compared to most other
attributes.

An ID can only be assigned an ID value which in practice means that it
can only be a fully qualified SGML name starting with a valid name_start
character and optionally followed only by valid name_characters.

At the other side we have the vast majority of HTML element attributes
that takes on values that boils down to be of type CDATA. Very few HTML
attribute values can actually be checked for validity, if one wanted to
do that, since the attribute values are never parsed.

ID values otoh are always parsed.


But "attribute" doesn't mean "property whose range of legal values is
limited" or "property whose value needs to be or can be validated
syntatically or semantically". Some attributes' values are restricted
and some aren't, that's all. So while your latest observations are
correct, they have no bearing on the correctness of my having referred
to ID as an attribute.
--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 20 '05 #13
On Wed, 15 Sep 2004 13:39:07 -0400, Harlan Messinger
<hm*******************@comcast.net> wrote:
Jan Roland Eriksson <jr****@newsguy.com> wrote: [...]
An ID can only be assigned an ID value... [...]At the other side ... HTML element attributes that takes on
values that boils down to be of type CDATA... [...]ID values otoh are always parsed.

But "attribute" doesn't mean "property whose range of legal values is
limited" or "property whose value needs to be or can be validated
syntatically or semantically".
The SGML standard is very specific about what constitutes an
'attribute'; from the "Handbook" pg.127...

"attribute (of an element): A characteristic quality,
other than type or content."

For all times of SGML the ID (and also IDCAP, IDLINK, IDREF, IDREFCAP
and IDREFS) has been treated as something special, apart from "normal"
attributes of an element.

The ID family of "attributes" (ID, IDREF and IDREFS) do not really set a
"characteristic quality" for the element where they appear but instead
they serve to provide identifiable points of reference and "hooks" to
points of reference in a document.
some attributes' values are restricted and some aren't, that's all.
The possible values for 'ID' in HTML is definitely described by a
(ridiculously big, but finite) number. That is not so with CDATA
attributes though, their range of allowed values are infinite.
So while your latest observations are correct, they have no bearing
on the correctness of my having referred to ID as an attribute.


If you only want my approval on your use of words I can grant you that
straight off. The "Handbook" lists ID, IDREF and IDREFS as attributes
too, but continues to great length to describe what it is that makes the
ID... family of "attributes" so special.

I'm an old "SGML sod" and I have over the years created quite a number
of "HTML authoring tools" based on the SP suite. Most often I find that
SGMLNORM is my best friend when it comes to production of markup good
enough to put up on a server somewhere.

ID's comes in handy in local processing at times but I have yet to find
that I define a set of ID values for any other purpose than to provide
hooks for linking and cross refs.

Others do use more "modern" approaches as in what came in on
comp.text.sgml just today...

<http://nedron.net/xml-test/fedora-boot-floppy.xml>

....where we can find some solid use of ID's in a 'docbook' document to
create parts of visible content that is gathered from ID'ed elements in
the original markup.

(XSLT capable version of Mozilla is required to view that document)

I'm not at all convinced that the 'TOC' produced on the fly (not part of
the visible markup) in that document could be said to be a
"characteristic quality" of the elements that was IDentified to be used
as a source of that 'TOC'? Correct me if I'm wrong?

--
Rex
Jul 20 '05 #14
Jan Roland Eriksson <jr****@newsguy.com> wrote:
On Wed, 15 Sep 2004 13:39:07 -0400, Harlan Messinger
<hm*******************@comcast.net> wrote:
Jan Roland Eriksson <jr****@newsguy.com> wrote:

[...]
An ID can only be assigned an ID value...[...]At the other side ... HTML element attributes that takes on
values that boils down to be of type CDATA...[...]ID values otoh are always parsed.

But "attribute" doesn't mean "property whose range of legal values is
limited" or "property whose value needs to be or can be validated
syntatically or semantically".


The SGML standard is very specific about what constitutes an
'attribute'; from the "Handbook" pg.127...

"attribute (of an element): A characteristic quality,
other than type or content."

For all times of SGML the ID (and also IDCAP, IDLINK, IDREF, IDREFCAP
and IDREFS) has been treated as something special, apart from "normal"
attributes of an element.

The ID family of "attributes" (ID, IDREF and IDREFS) do not really set a
"characteristic quality" for the element where they appear but instead
they serve to provide identifiable points of reference and "hooks" to
points of reference in a document.
some attributes' values are restricted and some aren't, that's all.


The possible values for 'ID' in HTML is definitely described by a
(ridiculously big, but finite) number. That is not so with CDATA
attributes though, their range of allowed values are infinite.
So while your latest observations are correct, they have no bearing
on the correctness of my having referred to ID as an attribute.


If you only want my approval on your use of words I can grant you that
straight off. The "Handbook" lists ID, IDREF and IDREFS as attributes
too, but continues to great length to describe what it is that makes the
ID... family of "attributes" so special.


What do I want with your approval? I knew I was right and the checking
the official sources confirmed it. The only question in my mind was
why you were continuing to reason why ID shouldn't be called an
attribute. The "specialness" of ID is irrelevant--the definition of
"attribute" isn't contingent on the attribute being non-special--and
the lack of restrictions on its value isn't relevant at all. (By the
way--since when is the ID of an HTML element--we were talking about
HTML, not SGML--not restricted?)

[snipping a bunch of stuff whose relevance eludes me]

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 20 '05 #15
On Thu, 16 Sep 2004 01:11:38 -0400, Harlan Messinger
<hm*******************@comcast.net> wrote:
Jan Roland Eriksson <jr****@newsguy.com> wrote:
On Wed, 15 Sep 2004 13:39:07 -0400, Harlan Messinger
<hm*******************@comcast.net> wrote:
Jan Roland Eriksson <jr****@newsguy.com> wrote:[...]
An ID can only be assigned an ID value...


[...]
...why you were continuing to reason why ID shouldn't be called an
attribute.
As per ISO8879[1] (the SGML standard) ID is listed among the other
attribute definitions because it's convenient to do so, still the
characteristics of ID (plus IDREF and IDREFS) is so different from other
attribute types that it must receive special treatment.
The "specialness" of ID is irrelevant...
Nope.
...and the lack of restrictions on its value isn't relevant at all.
You got that backwards, ID does have restrictions on its value
assignments. Most other attributes as defined in HTML have not[2].
(By the way--since when is the ID of an HTML element--we were
talking about HTML, not SGML--not restricted?)


What?

HTML claims to be an application of SGML[3][4], as such HTML is required
to follow all parts of the SGML standard. It is not allowed for HTML to
change the foundation upon which it is built.

[1]<http://www.iso.org/iso/en/CatalogueDetailPage.CatalogueDetail?CSNUMBER=16387 >
[2]<http://www.htmlhelp.com/reference/html40/attrs.html>
[3]<http://www.w3.org/TR/html4/conform.html#h-4.1>
[4]<http://www.w3.org/TR/html4/sgml/intro.html>

--
Rex
Jul 20 '05 #16
Jan Roland Eriksson <jr****@newsguy.com> wrote:
On Thu, 16 Sep 2004 01:11:38 -0400, Harlan Messinger
<hm*******************@comcast.net> wrote:
Jan Roland Eriksson <jr****@newsguy.com> wrote:
On Wed, 15 Sep 2004 13:39:07 -0400, Harlan Messinger
<hm*******************@comcast.net> wrote:

Jan Roland Eriksson <jr****@newsguy.com> wrote:
[...]
>An ID can only be assigned an ID value...

[...]
...why you were continuing to reason why ID shouldn't be called an
attribute.


As per ISO8879[1] (the SGML standard) ID is listed among the other
attribute definitions because it's convenient to do so, still the
characteristics of ID (plus IDREF and IDREFS) is so different from other
attribute types that it must receive special treatment.


When a set X is defined as all {x(i)} that have certain
characteristics, there is no implicit proviso "except for those x(i)
that have something else special about them". ID meets the definition
of "attribute", and is on top of it explicitly declared to be one.
There is no precept that justifies, "Oh, but it has other special
properties, so it really isn't an attribute after all."
The "specialness" of ID is irrelevant...
Nope.


The standards say you're wrong.
...and the lack of restrictions on its value isn't relevant at all.


You got that backwards, ID does have restrictions on its value
assignments. Most other attributes as defined in HTML have not[2].


Correct, I got my wires reversed.
--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 20 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

40
by: | last post by:
Could someone cite some offical rule or documentation with regard to the <P> tag? I've seen folks put it in between paragraphs... and others wrap it around a paragraph. I'd think to use it...
2
by: needhelp | last post by:
This one ought to be simple, but I have dug myself deeper and deeper, and gone farther and farther from what I wanted and I'm giving up. And my html that I've written is so bolloxed up now that...
15
by: Mason A. Clark | last post by:
I have a page with many links. Browsers like to underline the links -- result is ugly. Is there any (CSS?) way to prevent underlining? (By the way, I decry the common practice of making...
8
by: lkrubner | last post by:
Am I wrong, or do paragraphs have extra space on top in FireFox, when compared to Microsoft IE. The top of this page is an example: http://www.publicdomainsoftware.org/index.php?pageId=299 The...
1
by: Pete Griffint | last post by:
Howdy! I want to get the following in a Richtext control: Paragraph 1.... Paragraph 2... Obviously I want to do something like rtb.SelectedText="Paragraph 1...";...
0
by: pdreid | last post by:
Hi there. I am having an issue with one of my access forms. When the Is Hyperlink property is set to yes, underlining Yes and color blue. The link still only shows up with Blue writing and the...
7
by: Jukka K. Korpela | last post by:
After noticing that IE 7 beta supports selectors like p+p, I started wondering how to achieve a simple rendering of paragraphs so that 1) there is no vertical spacing between paragraphs (i.e. the...
5
by: keoo | last post by:
Im putting the part of the code which is relevant to my question......The program is opening the texfile which i already have created..Im not quite managing to make the program count the number of...
3
by: WebCM | last post by:
How to apply nice URL-s into CMS? 1. Should we use nice urls for every page? 2. Do we need to put a FULL path into <a href="">? 3. What is faster and better? a) 10 rules in .htaccess...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.