Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

first-child not working on IE 6

Status
Not open for further replies.

tfstom

Programmer
Sep 28, 2002
190
US
Does :first-child work on IE 6?

I can't seem to get it to work in the sample code I have been playing with. I was under the assumption this should take the first paragraph and make it larger that the others.

Is there something missing:

Here is the .css file:
Code:
/* story-5.6.css                  */
/* By Kynn Bartlett kynn@kynn.com */

.storytitle 
  { font-family: Verdana; }

.storybody p
  { font-family: Arial; }

.storybody p:first-child 
  { font-size: large; }

And the HTML file:

Code:
<!-- story-5.5.html                                   -->
<!-- By Kynn Bartlett                                 -->
<html>
  <head>
    <title>Fortune of Reversal</title>
    <link type="text/css" rel="stylesheet"
          href="story-5.6.css">
  </head>
  <body>
    <h1 class="storytitle">Fortune of Reversal</h1>
    <div class="storybody">
      <p>
        They dined on heaping platters of Szechuan chicken, of 
        spicy beef, of shrimp and vegetables in some exotic dish 
        without a name. Bits of food were passed from chopsticks 
        to chopsticks, violating all known laws of Chinese 
        cuisine etiquette. The tea flowed hot and fast that night, 
        until the meal finally concluded itself.
      </p>

      <p>
        "Thank you for dining here tonight," said the badgeless, 
        anonymous waitress. She placed a small tray containing the 
        check and two wrapped fortune cookies on the edge of the 
        table, and hefted the empty plates one by one, forming a 
        stack on the crook of her elbow.
      </p>

      <p>
        "Absolutely delicious," declared Oliver as he pulled a card 
        from his wallet and flicked it onto the bill. He picked up 
        the two cookies, an afterthought. "Fortune cookie, my 
        love?" he asked Amanda.
      </p>
    </div>
  </body>
</html>

thanks,

Tom.
 
Nope - IE6 supports only :first-letter and :first-line :(

Should work in netscape/moz and IE5 for mac, though... dunno for Opera 7.

 
I guess it is not something you would use if you don't know what everyone is using. The problem with the plugin is that everyone would have to have it.

Thanks,

Tom.
 
Plug-in is perhaps the wrong term to use. You put IE7 on your web server - it's a bit of Javascript called from within a CSS file. Every browser apart from IE ignores it, IE5.5+ executes it with the effect that IE starts recognising new CSS properties.

You don't have to worry about what people have on their PCs, they don't have to install anything or change any browser settings. Not really a "plug-in" at all. Sorry.

There are of course downsides:
[ol]
[li]IE7 is still under development, it may not work properly and/or cause unexpected problems[/li]
[li]IE users will load & run 10K of Javascript before they see anything on your first page - which may be unacceptable on dial-up.[/li]
[li]Your CSS file will not pass through the Validator - as this whole CSS/Javascript thing is non-standard Microsoft-only functionality. Personally I think it's worth putting up with one error message for the benefit of improved CSS support, but some are more doctrinaire about such things.[/li]
[/ol]
Incidentally, I'm not using IE7 on any of my web sites (yet), but I'll certainly think about doing so if I ever want to use the CSS2/3 rules it enables.

-- Chris Hunt
 

Dean's work is achieved using behaviours, a technology which certainly lets you do some really neat things with IE.

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top