I had studied earlier that embedded CSS always overrides external css. But I found that whichever comes last in the code, those styles prevail.
Please see the following code, considering that I have used color:green; in external CSS for h3
.
<head>
<link rel=stylesheet href="style.css">
<style>
h3{
color:red;
}
</style>
</head>
Output of the above code will show me any text I write inside h3
in red color.
But if I write the above code like this:-
<head>
<style>
h3{
color:red;
}
</style>
<link rel=stylesheet href="style.css">
</head>
In the above case, I get the color of text inside h3
as "green" (since assuming I have given "green" as font-color
in external CSS ).
This is because I have written link
tag after style
tag.
So which means that external css is not always over-ridden by embedded css.
Or is it a rule to write the link
tag always before style
tag in head
.
Please explain this point.