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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Merging CSS Styles (IE/FF) 1

Status
Not open for further replies.

ggriffit

Programmer
Oct 25, 2002
1,578
GB
Dear All,
at the moment I have two the following style for non IE :

.headerBar{background-color:green;text-align:left;}

and for IE :

.headerBar{filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1,StartColorStr='green',EndColorStr='white');width:100%; height:10%;}

I am building the style dependant on the browser that is being used, what I would like to do is to merge them into a single style so I would not need to do a browser detection, any ideas ?

Greg Griffiths
Livelink Certified Developer & ECM Global Star Champion 2005
 
You can use this - assuming you don't need to pass css validation :)
Code:
.headerBar{
  background-color:green;
  text-align:left;
  _filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1,StartColorStr='green',EndColorStr='white');
  _width:100%;
  _height:10%;
}

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
You would use a conditional test to determine whether the page was being viewed in IE, and then load a specific CSS file if that was the case.

Here is an example that will load a css file if you are running IE windows less than version 7...
Code:
<!--[if lt IE 7]>
	<link rel="stylesheet" href="/css/ieStyles.css" type="text/css" media="all">
<![endif]-->

This would require you break the class into two and store half in one css file - half in the other. Pretty much NOT what you were hoping for at the outset :)

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
maybe I'll just leave it with the JS browser detection to build the style in then, thanks for the assistance, have a star ;-)

Greg Griffiths
Livelink Certified Developer & ECM Global Star Champion 2005
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top