FF and IE hack weird problem

using this hack for ages now problem..

Page 1 of 1

6 Replies - 866 Views - Last Post: 19 June 2009 - 05:53 PM

#1 nightscream  Icon User is offline

  • D.I.C Head

Reputation: 19
  • View blog
  • Posts: 237
  • Joined: 04-December 08

FF and IE hack weird problem

Posted 18 June 2009 - 03:16 PM

Hi

I've stumbled into a weird css problem.
I've got 2 hacks one for IE6 and below and one for IE7.
Now it seems the hack is also read by firefox, in other websites I don't have this problem only in this new website.

The first one is for ff, second one for IE6 and third one for IE7.
If I use this css the margin in firefox is 0 0 0 0 so any ideas why this happens only on this website?

Thanks!

#info-product li {
	padding-top: 3px;
	margin: -15px 0 0 0;
	display: block;
}
*html #info-product li {
	margin: 0 0 0 0;
	
}
html>body #info-product li {
	margin: 0 0 0 0;
}


Is This A Good Question/Topic? 0
  • +

Replies To: FF and IE hack weird problem

#2 gregwhitworth  Icon User is offline

  • Tired.
  • member icon

Reputation: 219
  • View blog
  • Posts: 1,604
  • Joined: 20-January 09

Re: FF and IE hack weird problem

Posted 19 June 2009 - 07:44 AM

html>body #info-product li {
	margin: 0 0 0 0;
}



That's not a hack. That's using the parent selector set in CSS2:
http://www.w3.org/TR...child-selectors

Also - you shouldn't be using hacks in the first place. Mainly because when said browsers become aware of the hacks they usually fix them. You should utilize conditional comments set in place by IE (because they know how screwed up their browser is). This allows you to single out a browser - but it also maintains that it will work in the future as this is a feature - not a hack.

http://msdn.microsof...512(VS.85).aspx

Hope that helps,
Greg
Was This Post Helpful? 0
  • +
  • -

#3 nightscream  Icon User is offline

  • D.I.C Head

Reputation: 19
  • View blog
  • Posts: 237
  • Joined: 04-December 08

Re: FF and IE hack weird problem

Posted 19 June 2009 - 10:13 AM

mmh does this also work in css? or only in html?
Was This Post Helpful? 0
  • +
  • -

#4 gregwhitworth  Icon User is offline

  • Tired.
  • member icon

Reputation: 219
  • View blog
  • Posts: 1,604
  • Joined: 20-January 09

Re: FF and IE hack weird problem

Posted 19 June 2009 - 11:31 AM

You create conditional comments to link to different CSS docs - like so:

<!--[if (gte IE 5.5)&(lt IE 7)]><link type="text/css" rel="stylesheet" href="ie6.css" media="screen" /><![endif]-->


Was This Post Helpful? 0
  • +
  • -

#5 nightscream  Icon User is offline

  • D.I.C Head

Reputation: 19
  • View blog
  • Posts: 237
  • Joined: 04-December 08

Re: FF and IE hack weird problem

Posted 19 June 2009 - 02:43 PM

So is it possible to make a css for the whole page and than another css file with only the changes that need to be done(the fixes). So ie will overwrites the style or doesn't it work like that? because my fixes are most of the time just a few.
Was This Post Helpful? 0
  • +
  • -

#6 gregwhitworth  Icon User is offline

  • Tired.
  • member icon

Reputation: 219
  • View blog
  • Posts: 1,604
  • Joined: 20-January 09

Re: FF and IE hack weird problem

Posted 19 June 2009 - 03:30 PM

Yes. That's what you are supposed to do. Setup your layout to look good in FF or Opera and then follow the Cascade in the CSS, place your IE stylesheets at the bottom of the cascade.

<link type="text/css" rel="stylesheet" href="layout.css" media="screen" />
<!--[if (gte IE 5.5)&(lt IE 7)]><link type="text/css" rel="stylesheet" href="ie6.css" media="screen" /><![endif]-->



Hope that helps.

--

Greg
Was This Post Helpful? 1
  • +
  • -

#7 nightscream  Icon User is offline

  • D.I.C Head

Reputation: 19
  • View blog
  • Posts: 237
  • Joined: 04-December 08

Re: FF and IE hack weird problem

Posted 19 June 2009 - 05:53 PM

Thanks!

Now I don't have to use those hacks I've got problems with.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1