Issue
I'm looking over the page for border-width
on w3schools and it says that:
Note: Always declare the border-style property before the border-width property. An element must have borders before you can set the width.
I'm trying to find a reference corroborates this statement. It seems like declaring the border-width
before the border-style
works just fine.
.demo {
width: 100px;
height: 100px;
margin: 10px auto;
}
.ten-red-solid {
border-width: 10px;
border-color: red;
border-style: solid;
}
.red {
border-color: red;
}
.ten {
border-width: 10px;
}
.solid {
border-style: solid;
}
<div class="ten-red-solid demo"></div>
<div class="ten red solid demo"></div>
Solution
This isn't true.
W3Schools aren't an official documentation source and therefore any advice shouldn't be taken too seriously.
W3Schools is optimized for learning, testing, and training. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content.
Browsers evaluate styles once all of them have been loaded, irrespective of the order in which they are declared.
For clarity the following 2 styles are identical:
div{
border-width:2px;
border-style:solid;
border-color:#000;
}
div{
border-style:solid;
border-width:2px;
border-color:#000;
}
Answered By - Curtis
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.