DEV Community

Cover image for Css styling
Madhumita
Madhumita

Posted on

Css styling

CSS styles are applied in the order they are linked in your HTML code.

So if you had two stylesheets e.g. styles1.css and styles2.css which both target the same element e.g.

styles1.css

body {
background-color: red;
}
styles2.css

body {
background-color: blue;
}

If inside the head section if your HTML, you list your links as this:
Alt Text

Can you guess how the resulting page will be?
The resulting page will be blue.

But if you listed your links like this:
Alt Text

The resulting page will be red.

Essentially both styles are being applied, but the one that's visible at the end is the one applied last.

Top comments (0)