Another thing that a lot of people dont realise is that if you're
going to have different style sheets for different browsers, you dont
need to have multiple complete sheets.   It's called CASCADING style
sheets because style rules are overwritten as the browser CASCADES
down through the different sheets.

So. ...

you have one sheet that works for all your standards-compliant
browsers.   Make the site work in Firefox and Google Chrome.  (NEVER
work the other way - starting with making it work in IE  - you'll have
far too much trouble making it all play nicely)

Then you have another sheet for IE6 browsers that ONLY has the
DIFFERENCES from that first sheet.  In my experience, an IE6 CSS sheet
usually has only a few rules, and even then its not the whole rule,
only the parameters that are different from your main sheet.

For example:

your main style sheet might have the following rule:

#sidebarcontainer {
    border : none;
    float : right;
    margin-right : -19px;
    width : 210px;
    padding : 5px 0px 5px 5px;
    background-color : #FFFFFF;
}

and the IE6 style sheet has the following,

}
#sidebarcontainer {
margin-right: -10px;
}


and all that does is override the right margin for that div element,
and set a different margin-right for IE6 browsers.  everything else
remains the same as the main sheet.

The only reason you should need to maintain rules in several style
sheets is if the rule you're changing happens to be one of those few
rules you have to put in special sheets.   In the example above,  you
would only need to touch the IE6 CSS file if what you're changing is
the right margin for the #sidebarcontainer div.

In my experience,  once i have set up separate sheets, i RARELY touch
the browser-specific ones, because they are usually to correct layout
things - positioning,  allowing for different box models etc,  and
usually what i'm tinkering with style sheets about is colours, and
other things in the main style sheet.

Cheers
Mike Kear
Windsor, NSW, Australia
Adobe Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month


On Sat, Apr 4, 2009 at 11:14 AM, Peter Boughton <[email protected]> wrote:
>
>> Heh, well, it *is* considered bad practice
>
> Of course, browser-specific treatment is bad, but if (for some reason) you 
> can't avoid it, this seems cleaner and more readable than other methods?
>
>
>> user agents can be  spoofed and often are, as well as hidden or stripped
>
> I'd argue that if (e.g. Opera) users want to say "I'm IE", then they can be 
> treated as such - if that causes styles to screw up, it's their own fault.
>
> Likewise, if a browser [doesn't support standards and] is purposefully trying 
> to hide its identity, again, own fault.
>
> Possibly a bit harsh (especially if the latter is due to dumb "security" 
> admins/software), but since most of these differences are either browser 
> flaws or relatively minor tweaks, I think it's a fair stance. :)
>
>
>
>> If you've got a lot of rules specific to Firefox or Safari, then
>> something isn't quite right.
>
> Hmmm... depends how you define "a lot", I guess.
>
> And whether you count -moz-* or -webkit-* stuff too - since it's technically 
> engine-specific but of course doesn't apply if the browser doesn't support it.
>
> But for Firefox/Mozilla, anything involving fieldset/legend layout tends to 
> need special treatment due to the idiotic restrictions placed on legends.
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321320
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to