About border "solid" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

About border "solid"

is there any difference between border-style: solid and border: solid????

4th Jun 2018, 5:43 PM
Brian Morrison
Brian Morrison - avatar
3 Answers
+ 14
border is usually used as border: 1px solid black, thus combining 3 properties in one declaration. not sure if border: solid is valid, but if the browsers take it there should be no difference, anyway I don't recommend using it like that, sooner or later you'll run into trouble, better follow the specifications.
4th Jun 2018, 5:56 PM
Nikolay Nachev
Nikolay Nachev - avatar
+ 6
To extend what Nikolay said... border: solid; by itself is valid. It gives a default value for the width of 3px or so and the default color Black. And the same thing happens if you do border-style: solid; and do not define explicit values for border-width and border-style. Those two are given the same default values as above... So the only difference really is that border-style must take only one value, that is the style of the border and border can take up to three values. As you can deduct when using border the width and/or color can be omitted but not the style. And they must be entered in the right order: width style color...
4th Jun 2018, 6:20 PM
cyk
cyk - avatar
+ 2
thanks
4th Jun 2018, 6:24 PM
Brian Morrison
Brian Morrison - avatar