DoubleOSpoon Posted September 24, 2006 Share Posted September 24, 2006 Hey guys, I've been good at XHTML for a long time now, and i've started to get into CSS. I know a decent amount I suppose, I've done the tutorial on the site and one on another site, not sure how much more there is to learn though. I'm starting to create websites with my friend, he's going to be doing the design, and i'm going to do the coding. I'm practicing my skills right now, and I've run into a problem with browser compatibility using divs. I can align everything perfectly in Internet Explorer using code like this: div#par1 { position: absolute; top: 40px; left: 10px; } But, the code is completely messed up in FireFox. My friend says the Position property doesn't work correctly in FireFox. I've noticed it works in FireFox, but if I use it too much my text and images are lined up wrong and overlap. I cannot make my layout function the way I'd like. He also said there's a code to have CSS function differently in FireFox, something like: <firefox: "execute this file"> I know there must be a way to have a website function in all web browsers, if anyone knows the code or can help me out i'd appreciate it. Thanks! Link to comment Share on other sites More sharing options...
boen_robot Posted September 24, 2006 Share Posted September 24, 2006 The code he speaks about actually belongs to IE and it's called a conditional comment. It allows a specific (X)HTML code to run only for different versions of IE. So you can have: <!--Stylesheet for IE, Firefox, Opera and other browsers--><link rel="stylesheet" type="text/css" href="style.css" /><!--[if lte IE 6]><!--Stylesheet only for IE6 and IE5. Note that the stylesheet above is also used, so this stylesheet must only contain the fixes for IE.--><link rel="stylesheet" type="text/css" href="IEstyle.css" /><![endif]--> Link to comment Share on other sites More sharing options...
DoubleOSpoon Posted September 24, 2006 Author Share Posted September 24, 2006 Thanks a lot!! I am confused though.. the way I see it, I need to code a site to match FireFox first. And then fix the errors to meet Internet Explorer's standards and use that code to run my External Style Sheet so only IE runs it. Am I right so far..? Link to comment Share on other sites More sharing options...
boen_robot Posted September 24, 2006 Share Posted September 24, 2006 Almost... I need to code a site to match FireFox first. And then fix the errors to meet Internet Explorer's standardsexactly...and use that code to run my External Style Sheet so only IE runs it. Am I right so far..?I'm not sure what you meant with this one.After you're done with FF, you add the IE fixes in another file. That file is called along side the FF stylesheet. Because it's called AFTER the FF stylesheet, everything in it is with higher priority over the common styles. The first one is used by everyone. Link to comment Share on other sites More sharing options...
DoubleOSpoon Posted September 24, 2006 Author Share Posted September 24, 2006 Well what I mean is.. I basically need to make two separate style sheets. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now