views:

53

answers:

5
*html .... (IE6)
html > body ....(IE7/FF)

* html is special tag for IE6. Does IE7 has something too? i need just some small css detail in IE7. Just for IE7 without FF.

+1  A: 

there is *:first-child+html, which you can prepend to fieldset. You should be using conditional comments though.

Your rule should look like..

*:first-child+html fieldset { }

meder
but not working for IE7
senzacionale
@sen: what does your selector look like? It should work for IE7 and **only IE7**.
BoltClock
i read this howto: http://www.webdevout.net/css-hacks so my selector looks like *:first-child+html fieldset { padding: 20px 0 0 10px; }
senzacionale
@sen: IE7 should recognize it. Are you sure that isn't being overridden by another more generic `fieldset {}` style?
BoltClock
you are right it works. Thx for help. It was overriden.
senzacionale
+1  A: 

* html is not a special tag for IE 6, it's rather an ugly hack exploiting a bug in the browser. You can use the conditional comments to include stylesheet for the various versions of IE:

<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="ie6.css" />
<![endif]-->

<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="ie7.css" />
<![endif]-->
dark_charlie
i need just for one small tag, so i do not need whole css.
senzacionale
+1  A: 

As meder says, you can use the

*:first-child + html fieldset

selector.

However, I'd recommend that you use conditional comments instead. If you don't need to link to a separate IE-catering stylesheet (as dark_charlie suggests), just use the conditional comments on a <style> element in your HTML instead. Put your IE7 styles there:

<!--[if IE 7]>
<style>
fieldset {
    /* Your IE7 styles for <fieldset> go here */
}
</style>
<![endif]-->

The same goes for IE6 - use a separate set of conditional comments but open using <!--[if IE 6]> instead.

BoltClock
A: 

This will proably answer your question: CSS Hacks, but try to avoid them as much as possible :)

Tom
+2  A: 

I've already used this answer to another question, but it applies here also:

I have a solution that I use only when I have to, after I build my html & css valid and working in most browsers, I do the occasional hack with this amazing piece of javascript from Rafael Lima. http://rafael.adm.br/css_browser_selector/

It keeps my CSS & HTML valid and clean, I know it's not the ideal solution, using javascript to fix hacks, but as long as your code is originally as close as possible (silly IE just breaks things sometimes) then moving something a few px with javascript isn't as big of a deal as some people think. Plus for time/cost reasons is a quick & easy fix.

Nicknameless