Mar 25, 2009

Default CSS Settings

Credera Team

Credera Team

Default image background

Each browser applies its own default settings to HTML tags.  For example, while IE and Firefox may both add a default top margin to the <p> tag, the size of that margin spacing may be different in each browser.  Further, one browser may apply a default lower margin or padding, for example, while another browser may not.  Ignoring this issue, the spacing before or after <p> tags in your site may appear different between browsers.  This principle is true for many HTML tags, including:

  • All header tags <h>

  • <div> tags

  • <span> tags

  • <p> tags

  • All list tags <ul> <ol> <li>

While this list is not exhaustive, it does provide a starting place to tackle browser compatibility.  The example below illustrates the different default margins applied to the <p> in IE and Firefox.

A simple work around for this issue is to replace each browser’s default styles with your own designated style in the CSS:

p { padding: 0px 0px 0px 0px;  margin: 0px 0px 0px 0px; }

Inserting the above code into your CSS file will overwrite any default margins or padding added by each browser, giving your code a consistent style across all browsers.

Conversation Icon

Contact Us

Ready to achieve your vision? We're here to help.

We'd love to start a conversation. Fill out the form and we'll connect you with the right person.

Searching for a new career?

View job openings