CSS Conditional Styling - Iron out Browser Differences

From Webmaster-A Webmaster Resources

CSS Browser Differences

One of the main causes for the many positional differences between layouts in various browsers is due to the default stylesheet each browser applies. So unless you want to generate a huge stylesheet specifying everything about every single element then you will need more than one stylesheet. These differences usually involve setting default margins and padding to some elements to make them behave in a certain way.

For instance, paragraph (p) tags will have a margin applied to them so that each paragraph is separated by vertical white space and do not run into each other. The same applies to many other tags including heading tags (h1 etc). The problem occurs because the amount of margin (or padding) applied to these elements is nowhere near consistent across browsers. On a lot of occasions Mozilla/Firefox will add a top margin to the element as well as a bottom margin. IE will however only add a bottom margin. If you were then to view these two browsers side by side you would see that the alignment would be different due to the top margin applied by Mozilla which could well make your design do something totally unexpected.

In some designs this may not be a problem but in cases where position is important, such as aligning with other elements on the page, then the design may look bad.

To get around this you have to treat internet explorer as the exception, since only IE has provision for conditional commenting. The way to do this is to design the page in Firefox, then add the following code to the page after your main css file include or page stylesheet.

Now you can put in this stylesheet any margins/padding you need to alter for internet explorer. Done!

Next: CSS Text Content Layout


Tutorial Contents


CSS Tutorial Referrers

bookmark hit - internal hit - smiawaoss.me - mioaeka.me - kkkkkkp.com - www.google.com - amsns.com - sibuj.me - www.google.co.in - ... - ... - ... - www.google.ca - ... - ... - ... - www.cantius.org - ... - ... - ... - ... - socialcrowd.biz - yourgoodtime.com - ... - ... - ... - ... - commandarticles.info - ... - ... - ... - becalmzcarloa.info - highhyip.com - forum.wearcase.com - doubtarticles.info - exxonsecrets.org - ... - ... - ... - bookmarkfalcon.com - ... - ... - www.hgt435lop345.com - www.google.com.br - www.google.se -

This list of people who link to this Tutorial page is automagically maintained. Link to us, send traffic, and get listed. Simple.