Loading content, Please wait..

Web standards are prevailing guidelines used on the World Wide Web to ensure web sites and information is accessible to all in the most efficient manner. Most Web browsers have different default settings for the base margin and padding.

This means that if you don’t set a margin and padding on your body and xHTML tags, you could get inconsistent results on the page depending upon which browser your users are using to view the page. A simple way to solve this is to set all the margin and padding on the xHTML and body tags to 0:

html, body {
margin: 0px;
padding: 0px;
}

This will keep your design structure in the same place on all browsers.

Borders

You may be thinking “but no browsers have a border around the body element by default”. This is not strictly true. Internet Explorer has a transparent or invisible border around elements. Unless you set the border to 0, that border will mess up your web-page layouts. So add the following to your body and xhtml styles:

html, body {
margin: 0px;
padding: 0px;
border: 0px;
}
Here’s a nice and detailed article on CSS Reset: Resetting Your Styles with CSS Reset Stay tuned for more web-design tips.

5 Responses to “CSS Tips – Get Consistent Results in All Browsers”

 


03 May, 2009

I use and I think is better to use this piece of code:

* { padding: 0; margin: 0; )

 


28 Apr, 2009

This is a really informative site.

 


25 Apr, 2009

And when you’re using a Reset Stylesheet, make sure you link it before your own custom Stylesheet when doing the (x)HTML of the website. I have seen several people posting in forums about their stylesheets not working at all. And in the end, the only issue that appears is that they had invoked the reset stylesheets after their own custom stylesheet!

 


25 Apr, 2009

I go even further when resetting css. I make a separate css file that pretty much resets all elements of html. The only elements I leave out is the ones I’m not going to use for the project. Then use a different css file to do my designing in.

 


24 Apr, 2009

Resetting your HTML styles is the most basic and one of the most important thing to do when developing a website. Overlooking this is the root of several ugly websites that litter the web and break across different browsers.

In addition to the above, I generally use these with the HTML and BODY tags:

font-size: 100%;
vertical-align:baseline;
background: transparent;

Is helpful in cases when users have styled their browser (background color, larger font size, etc.) or some browser skins that may change the appearance of a web page.


 

Trackbacks

Leave a Reply


This field is required.



This field is required.




I want to thank you for developing my site as per my design and helping me meet my web requirements on time and as per my need. I am sure we can work together on more projects in the future.
~ Teddy Jacob | TeddyJacob.net

"Mohit did an excellent job on a web project for me. The look, design, and service were all great. I really appreciated his work and the time he took to explain things. I highly recommend Mohit." ~ Chris Barnstable-Brown
Top qualities: Great Results , Good Value , On Time

"After hiring Mohit for the first time in 2007... I kept on consulting, hiring, and using Mohit's expertise in many website development projects where he exhibited unique talent in delivering his work on time and on budget." ~ Ali Husain
Top qualities: Great Results , Expert , On Time

"CSSJOCKEY is AWESOME. His work was fast, extremely well executed and we will DEFINITELY use his services in the near future. Having someone like this in our team makes life a hell of a lot easier. We absolutely 110% recommend using his web services." ~ Dan Atkins, Creator of the Superhero Mindset Programme

"Mohit is the Man! He whipped up a custom design for his coming soon plugin within a day and nailed it. His plugin is so easy to install and set up. I couldn't be more happy! He responded to my inquiry very quickly and answered all my questions. I'll definitely use his services again in the near future." ~ Client (Rebecca Cunningham)

"CSSJockey designed a very clean and beautiful layout for us and then built an easy to manage website. The project was quick and painless, a pleasure for sure." ~ Client (NDA)

Awesome theme! Thanks much. I love this theme, especially granite and copper dust.. ~ Vivek

Accredits & Testimonials!