What is User Agent Stylesheets?

Asked

Viewed 7,652 times

12

Studying on CSS I came across the term User Agent, or standard style sheets used by browsers in case of absence of style sheets.

  • What is the User Agent?
  • Each browser has one User Agent?
  • Is there any way to ignore them, if yes how?

See in the image below that by default the Google Chrome defined the body of the document HTML with margin: 8px;

CSS

  • Need you to improve something?

  • 1

    The reply of the bigown clarified his CSS doubt, but perhaps there is still a misunderstanding of terminology. User-agent is the browser itself, which is who "acts on behalf of the user". Therefore User Agent Stylesheets are the "native" style sheets of the browser.

  • The question indicates that it is not(va) clear to you that user-agent = browser. The answer does not address this directly.

  • @bfavaretto understood what I meant. Do not want to try an answer?

  • Thank you, but I think the current answer + my comment already clarify for future visitors.

2 answers

11


This indicates that default style set in the browser has been used (or another form that is being used for render that element). It is only used if really no style has been used on it, even on other levels.

Remember that CSS works in cascade, an element always inherits the previously defined properties on another level. The first of these levels, which is usually superimposed by a more specific level, is the user agent, is the default browser.

The order would be:

  • User agent style Sheets (the browser)
  • User normal style Sheets (a custom user setting)
  • Author normal style Sheets (you who made the page)
  • Author Important style Sheets (when you say it is "important)
  • User Important style Sheets (when user says it is "important)

That can be seen in the specification.

You ignore this use by creating a style of your own, which is the normal one that everyone does.

-3

Answering your second question --> There is no "default" way to write a user agent sequence, so browsers use different formats, some are different, and many web browsers put a lot of information into their user Agents.

  • Welcome to Stackoverflow, what would be this Well Different between one and the other? Why do they come out different and aren’t all the same? Do you have a source? It would be nice if you further substantiated your answer ;)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.