id selector and IE

S

steven

Please have a look at http://users.pandora.be/nenya/anor2/0122.htm
I'm using an id selector to define a style for the paragraphs in a div:

div#div1 > p {
border-bottom: 1px solid #006699;
color:red;
margin-left: 20px;
}

ok in Mozilla, not ok in IE: the style is also applied to the paragraphs
outside the div. Other browsers?
Yet Another IE Bug? How can I fix this?
TIA

Steven
 
M

Mark Parnell

div#div1 > p {
border-bottom: 1px solid #006699;
color:red;
margin-left: 20px;
}

ok in Mozilla, not ok in IE:

IE doesn't support the child selector, >

Try

div#div1 p {
blah
}

Not a very descriptive ID, BTW.
Yet Another IE Bug? How can I fix this?

You mean you actually need to ask?
 
S

steven

Mark Parnell said:
IE doesn't support the child selector, >

Try

div#div1 p {
blah
}

Not a very descriptive ID, BTW.

It's not the actual div's name. I made a small demo page to show the effect,
without too much clutter.
You mean you actually need to ask?

:)
Thanx Mark. You too Brucie

Steven
 
R

Richard

steven said:
Please have a look at http://users.pandora.be/nenya/anor2/0122.htm
I'm using an id selector to define a style for the paragraphs in a div:
div#div1 > p {
border-bottom: 1px solid #006699;
color:red;
margin-left: 20px;
}
ok in Mozilla, not ok in IE: the style is also applied to the paragraphs
outside the div. Other browsers?
Yet Another IE Bug? How can I fix this?
TIA

I would strongly suggest not using a tag name as a class/id name.
use a more unique name such as ndiv or mydiv.
The system would not be confused trying to figure out what to do with it.

Why are wanting to color the bottom border of a paragraph?
Just use <hr>.
 
B

Beauregard T. Shagnasty

Quoth the raven named Richard:
I would strongly suggest not using a tag name as a class/id name.
use a more unique name such as ndiv or mydiv.
The system would not be confused trying to figure out what to do with it.

"div1" is not a valid tag name (element) and is every bit as unique as
"ndiv" or "mydiv". No css-capable browser that I know would be
confused by "div1"
Why are wanting to color the bottom border of a paragraph?
Just use <hr>.

IMO, Steven is attempting to go the right route, eliminating
non-essential content. If the underline is important enough though, he
might add an <hr> with { display: none } if he wishes to cater to
non-css browsers.
 
Q

qx

Mark Parnell said:
IE doesn't support the child selector, >

More specifically, IE for Windows doesn't. IE for Mac does,
along with other goodies like the adjacent selector and fixed
positioning.
 
S

steven

Beauregard T. Shagnasty said:
Quoth the raven named Richard:
it.

"div1" is not a valid tag name (element) and is every bit as unique as
"ndiv" or "mydiv". No css-capable browser that I know would be
confused by "div1"

I guess Richard overlooked the '1'.

IMO, Steven is attempting to go the right route, eliminating
non-essential content.

Ah, finally somebody who can understand me.
And it also explains the idiotic div name. (FYI, the actual div name is
"mainmenu").
Thanx for the replies, everyone.
 
K

Kris

IMO, Steven is attempting to go the right route, eliminating
non-essential content.

Ah, finally somebody who can understand me.[/QUOTE]

The everlasting battle between those who understand the differences
between separating and encapsulating content, and those who don't.
 
J

Jukka K. Korpela

Richard said:
I would strongly suggest not using a tag name as a class/id name.

Why? It might not be optimally informative and mnemonic to a human
reader, but surely there's nothing technically wrong with using
<div class="div" id="div">.

And it could make perfect sense in some cases to use a tag name
(that is, a string that is also defined as a tag name, or element name
to be more exact). For example, if you, for some reason, wrap all your
body content into a div element, what would be more logical than assign
class "body" to it?
use a more unique name such as ndiv or mydiv.

That would hardly be any more understandable.
The system would not be confused trying to figure out what to do
with it.

Have you any actual evidence of a browser getting confused with the use
of a tag name as a class or id name? Please let us know, so that we can
avoid such horrendously buggy wowsers.
 
W

Whitecrest

The everlasting battle between those who understand the differences
between separating and encapsulating content, and those who don't.

Actually, understanding when presentation matters is a better skill.
 
W

Whitecrest

Why? It might not be optimally informative and mnemonic to a human
reader, but surely there's nothing technically wrong with using
<div class="div" id="div">.

There is also nothing wrong with naming variables x,y,z but good
practice tells us to use descriptive manes. So while there is nothing
technically wrong with this naming convention, it is not recommended by
many (dare I say most).
That would hardly be any more understandable.

I agree ndiv is no better than Div. LeftSideMenu would be a better more
descriptive name.

YMMV
 
Q

qx

Whitecrest said:
LeftSideMenu would be a better more descriptive name.

What if another stylesheet renders the bar to the right, or as a
horizontal bar at the top? ;-)
 
J

Jeff Thies

I would strongly suggest not using a tag name as a class/id name.
Why? It might not be optimally informative and mnemonic to a human
reader, but surely there's nothing technically wrong with using
<div class="div" id="div">.

Oddly, I've been doing exactly that in some of my generated content. It's
clear to me that assigning class="p" lets me style all those pararagraphs
without guessing at the classname.

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top