Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a user agent stylesheet?

I'm working on a web page in Google Chrome. It displays correctly with the following styles.

table {     display: table;     border-collapse: separate;     border-spacing: 2px;     border-color: gray; } 

It is important to note that I didn't define these styles. In Chrome developer tools, it says user agent stylesheet in place of the CSS file name.

Now if I submit a form and some validation error occurs, I get the following stylesheet:

table {     white-space: normal;     line-height: normal;     font-weight: normal;     font-size: medium;     font-variant: normal;     font-style: normal;     color: -webkit-text;     text-align: -webkit-auto; }  table {     display: table;     border-collapse: separate;     border-spacing: 2px;     border-color: gray; } 

The font-size from these new styles is disturbing my design. Is there a way to force my stylesheets and if possible, completely overwrite Chrome's default stylesheet?

like image 361
Kapil Sharma Avatar asked Sep 25 '12 12:09

Kapil Sharma


People also ask

How do I find the user agent stylesheet?

If its simply viewing it, then go to Tools -> Developer Tools (Shift+Ctrl+I) then click on the Element tab and the Computed Style on the right hand side should show you the default values.

What is user agent stylesheet inspect?

User agent style sheets are overridden by anything that you set in your own style sheet. They are just the rock bottom: in the absence of any style sheets provided by the page or by the user, the browser still has to render the content somehow, and the user agent style sheet just describes this.


1 Answers

What are the target browsers? Different browsers set different default CSS rules. Try including a CSS reset, such as the meyerweb CSS reset or normalize.css, to remove those defaults. Google "CSS reset vs normalize" to see the differences.

like image 176
Oliver Millington Avatar answered Oct 20 '22 21:10

Oliver Millington