ClioSport.net

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • When you purchase through links on our site, we may earn an affiliate commission. Read more here.

CSS Hacks? IE7?

Car  306 TD Slut
So it looks like the new rubbish IE7 has corrected some issue's it had and now ignores css hacks like the *html??

Something is bugging me, i want my content div on a website to have padding-top: 5px; but only in IE7 is ther a way of doing this?

Also can i specify some javascript somewhere which sets specific font sizes depending on what browser it is viewed in?

Or can i just do this with css? like specifying a stylesheet for IE7/6? conditional comments?

ta
 
The issue with JS is, what happens if the user has JS dissabled? that font size function would not work.

You can do conditional tests and from there choose what CSS file they should be using.

There are many hacks available, I do not know any by memory, I simply use google to search what is required, there are some CSS forums which are very helpful.
 
<!--[if IE 7]>
content { padding-top: 5px; }
<![endif]-->

if i stuck that in my css file would that work?
 
No, Your comments need to go in the head of the page. There you feed in different stylesheets depending if it's IE or not. See here for an example:

www.cliomods.com
 
woah thats well clever, so u say if its a certain browser it does different stuff,

sorry i no nothing about it, just thout thats pretty clever.
 
grrr its not working!!

Code:
<!--[if IE 7]>
<link href="/floie.css" rel="stylesheet" type="text/css" />
<![endif]-->

Code:
#content {
    padding-top:60px;
    }

there is no padding-top:60px; set in the default style sheet so its not as if its conflicting..
 
Last edited:
i used another method which seems to have worked fine :)thanks tho red cup.

FYI i used this method.

Code:
<body>

<!--[if IE 7]>  
            <div id="IEroot">  
            <![endif]-->

<div id="wrapper">

<div id="content">blah blah blah webpage here</div>

</div><!--wrapper END-->

<!--[if IE 7]>
    </div>
    <![endif]-->

</body>

then set the css to:

#content {
    padding-top: 0px;
    height: 600px;
    width: 770px;
    position: relative;
    border-bottom-width: 1px;
    border-bottom-style: dotted;
    border-bottom-color: #9114B1;
}

#IEroot #content {
    padding-top: 20px; 
}
 
woah thats well clever, so u say if its a certain browser it does different stuff,

sorry i no nothing about it, just thout thats pretty clever.
Most sites will have hacks all over the place lol. However, I just had to do a website where I could not do any conditional tests. Worked out OK though.

Out of interest, why would you want that on IE7 only?
 
it seems to look fine on IE5 +6 just not 7 strangly, however when the site is complete, no doubt i will stick it up here for a grilling.
 
grrr its not working!!

Code:
<!--[if IE 7]>
<link href="/floie.css" rel="stylesheet" type="text/css" />
<![endif]-->
Code:
#content {
    padding-top:60px;
    }
there is no padding-top:60px; set in the default style sheet so its not as if its conflicting..

Change the css above to: padding-top: 60px !important; That should force it to show.
 
oo interesting, i have seen the !important previously, didnt think to put it in there, its osrted now anyway, cheers
 
Back
Top