id selector and IE

Discussion in 'HTML' started by steven, Jan 22, 2004.

  1. steven

    steven Guest

    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
     
    steven, Jan 22, 2004
    #1
    1. Advertising

  2. steven

    brucie Guest

    in post: <news:CHYPb.851$-ops.be>
    "steven" <> said:


    > div#div1 > p {
    > ok in Mozilla, not ok in IE:


    IE doesn't support child selectors


    --
    brucie - i usenet nude
     
    brucie, Jan 22, 2004
    #2
    1. Advertising

  3. steven

    Mark Parnell Guest

    On Thu, 22 Jan 2004 23:06:10 GMT, "steven" <>
    declared in alt.html:

    > 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?

    --
    Mark Parnell
    http://www.clarkecomputers.com.au
     
    Mark Parnell, Jan 22, 2004
    #3
  4. steven

    steven Guest

    "Mark Parnell" <> wrote in message
    news:1t673pwvti2wq$.10ow47ho43t2o$...
    > On Thu, 22 Jan 2004 23:06:10 GMT, "steven" <>
    > declared in alt.html:
    >
    > > 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.


    It's not the actual div's name. I made a small demo page to show the effect,
    without too much clutter.

    >
    > > Yet Another IE Bug? How can I fix this?

    >
    > You mean you actually need to ask?


    :)
    Thanx Mark. You too Brucie

    Steven
     
    steven, Jan 22, 2004
    #4
  5. steven

    Richard Guest

    steven wrote:

    > 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


    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>.
     
    Richard, Jan 23, 2004
    #5
  6. Quoth the raven named Richard:

    > steven wrote:
    >
    > > 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

    >
    > 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.

    --
    -bts
    -This space intentionally left blank.
     
    Beauregard T. Shagnasty, Jan 23, 2004
    #6
  7. steven

    qx Guest

    Mark Parnell <> wrote:
    > 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.
     
    qx, Jan 23, 2004
    #7
  8. steven

    steven Guest

    "Beauregard T. Shagnasty" <> wrote in message
    news:4O1Qb.7008$...
    > 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"


    I guess Richard overlooked the '1'.


    > > 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.


    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.

    --
    Steven
     
    steven, Jan 23, 2004
    #8
  9. steven

    Kris Guest

    In article <7O4Qb.1255$-ops.be>,
    "steven" <> wrote:

    > > > 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.

    >
    > Ah, finally somebody who can understand me.


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

    --
    Kris
    <> (nl)
    <http://www.cinnamon.nl/>
     
    Kris, Jan 23, 2004
    #9
  10. "Richard" <anonymous@127.000> wrote:

    > 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?
    <body><div class="body">...</div></body>

    > 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.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Jan 23, 2004
    #10
  11. steven

    Whitecrest Guest

    In article <4all.nl>,
    erlands says...
    > 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.

    --
    Whitecrest Entertainment
    www.whitecrestent.com
     
    Whitecrest, Jan 23, 2004
    #11
  12. steven

    Whitecrest Guest

    In article <Xns947980143B578jkorpelacstutfi@193.229.0.31>,
    says...
    > > 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">.


    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).

    > > use a more unique name such as ndiv or mydiv.

    > That would hardly be any more understandable.


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

    YMMV

    --
    Whitecrest Entertainment
    www.whitecrestent.com
     
    Whitecrest, Jan 23, 2004
    #12
  13. steven

    qx Guest

    Whitecrest <> wrote:
    > 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? ;-)
     
    qx, Jan 23, 2004
    #13
  14. steven

    Jeff Thies Guest

    > > 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
     
    Jeff Thies, Jan 26, 2004
    #14
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Henry
    Replies:
    3
    Views:
    6,098
  2. Arandil
    Replies:
    1
    Views:
    1,327
    Arandil
    Apr 12, 2004
  3. HK
    Replies:
    5
    Views:
    3,732
    Esmond Pitt
    Apr 23, 2005
  4. Luigi Donatello Asero

    Class selector, ID selectors and link pseudo-classes

    Luigi Donatello Asero, Jun 4, 2005, in forum: HTML
    Replies:
    4
    Views:
    521
    Luigi Donatello Asero
    Jun 4, 2005
  5. Luigi Donatello Asero
    Replies:
    1
    Views:
    403
    Luigi Donatello Asero
    Jun 4, 2005
Loading...

Share This Page