Jordan Davis
Jordan Davis

Reputation: 1520

Remove browser default styling <!DOCTYPE>

Is there a way or <!DOCTYPE> declaration such as XHTML or HTML4 that would remove the default CSS styling on elements?

Upvotes: 4

Views: 20458

Answers (4)

Pratik Thorat
Pratik Thorat

Reputation: 513

I personally have been using the code below for all of my projects till date.

*{
    margin:0;
    padding:0;
    box-sizing: border-box;
}

Also here an article if you are looking for a complete reset of some kind http://meyerweb.com/eric/tools/css/reset/

Upvotes: 3

edvilme
edvilme

Reputation: 578

There are several ways to do that, depending on what you want to do.

You can override a style in case using !important, for example:

div{ display: inline !important }

On buttons and inputs:
Input{
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none /not sure if it works on IE/
}

Upvotes: -3

Yasin Yaqoobi
Yasin Yaqoobi

Reputation: 2040

Doctype is not used for styling. There are two prominent ways of removing all the styles and uniforming the default look.

  1. normalize.css https://necolas.github.io/normalize.css/
  2. reset.css http://meyerweb.com/eric/tools/css/reset/

add these styles to your css before your stylesheet to uniform you layout to a certain degree, across different browsers. What is the difference between Normalize.css and Reset CSS?

Upvotes: 9

Quentin
Quentin

Reputation: 943591

No.

Elements have to have a default styling. It doesn't make sense for most properties to lack any value at all.

Take display for instance. If display wasn't set, how would the element render? The same way as if it was display: none? Then none would just be the default value.

If you don't like a default value for a property for a given element, then use a stylesheet to set a value you do like.

Upvotes: -1

Related Questions