Reply
A Basic Newbie Question
Old 11-04-2008, 10:48 AM A Basic Newbie Question
Skilled Talker

Posts: 67
Trades: 0
Okay! Here's the deal. I am trying to teach myself css and learning as I go so bear with me.

I have been playing with a page. I get the code to work in IE7 and it doesn't look right in FF or Opera. So I pull my hair out trying to get to look the same in all 3 browsers and it ain't working.

So, I figured that I would just have 2 files - 1 for IE and 1 for FF and Opera.

This is the first time to try this and I'm not sure how to call up the different stylesheets to fit the browser. For example, I was thinking that I would have pg1A.css called if someone is using IE7 and leave the default pg1.html for FF and Opera.

I have tried to understand this and it's just not working. Maybe I'm too thick-headed, but is this possible and if so, how can I do this?

Thanks
JustAGuy is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 11-04-2008, 10:57 AM Re: A Basic Newbie Question
Experienced Talker

Posts: 34
Trades: 0
Don't beat yourself over something that has been the trouble for all web designers alike. The best advice I can tell you is to reset the browser from scratch, and then start from there. You can do this by using * {margin: 0; padding: 0;}
pingeyeg is offline
Reply With Quote
View Public Profile
 
Old 11-04-2008, 12:04 PM Re: A Basic Newbie Question
Brian07002's Avatar
Defies a Status

Posts: 1,824
Name: ...
Location: ...
Trades: 0
If it's not broke don't fix it
Brian07002 is offline
Reply With Quote
View Public Profile
 
Old 11-04-2008, 01:17 PM Re: A Basic Newbie Question
aldor's Avatar
Ultra Talker

Posts: 459
Name: Alan
Location: Lincoln(UK)
Trades: 0
To call an alternate style sheet written for IE put this in your head section:-

Code:
<!--[if IE]>
<link rel=”stylesheet” href=”pg1A.css” type=”text/css”>
<![endif]–>
Call your style sheet for other browsers like this:-

Code:
<link rel=”stylesheet” href=”pg1.css” type=”text/css”>


The above assumes your CSS files are in the same directory as your HTML files, otherwise you will need to adjust the path.

Hope this helps.
aldor is offline
Reply With Quote
View Public Profile
 
Old 11-04-2008, 02:56 PM Re: A Basic Newbie Question
LadynRed's Avatar
Super Moderator

Posts: 9,036
Location: Tennessee
Trades: 0
Ok, I have to say it - if you're trying to make it look right in IE FIRST, you're approaching the problem BACKWARDS. Get it to be 'right' in Firefox first, then you'll be 99.9% of the way there for Opera and Safari (and almost for IE7). THEN you go back and address IE's bad behavior with conditional comments to call separate stylesheets that hold only the 'fixes' needed for IE.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 11-04-2008, 05:25 PM Re: A Basic Newbie Question
vangogh's Avatar
Post Impressionist

Posts: 9,845
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
It's part of the learning curve and many of us have pulled our hair out over the very same things.

LadynRed is right. It will usually end up being easier if you code for Firefox first and periodically check how things look in IE. The more experience you gain the more you'll know in advance where FF and IE differ and how to ensure your page works best in both.

For example when it comes to lists, one browser uses margin to indent the list and the other uses padding. If you set both margin and padding on your lists to 0 that will make both browsers see the same thing. Then you can add back margin or padding as you like to indent things. The idea is you need to explicitly set both for the two browsers to agree.

I think most of us here will develop for Firefox and maybe end up with a half dozen lines of code that need to be written specifically for one version of IE or another. Then we use conditional comments to serve the IE specific css to IE. At least that's what I usually end up doing.
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 11-05-2008, 07:30 AM Re: A Basic Newbie Question
rezzy's Avatar
Super Talker

Posts: 115
Location: in the interwebz
Trades: 0
Quote:
Originally Posted by vangogh View Post
I think most of us here will develop for Firefox.
Exactly vangogh. I refuse to upgrade my browser to IE6 just for that particular reason (and I want to stick it to the man). But in my experience IE6 is the roughest and toughest browser to get to work.

And unfortunately is still being using by someone out there.

I actually rarely use those IE hacks though, for some reason, it usually works out, at least I think it does. But I will keep the code in mind for future projects. I know it will come in handy.
__________________
Php Blog
Resnodesigns
rezzy is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to A Basic Newbie Question
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.10387 seconds with 13 queries