Why does border-top CSS selector work only below the main border selector? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 2

Why does border-top CSS selector work only below the main border selector?

The "border-top:" selector when used above the "border:" selector does not work. But when put below it, it works. Why does it happen? Does it happen with other selectors as well?

29th Mar 2018, 2:48 PM
Ram Keswani
Ram Keswani - avatar
2 ответов
+ 2
CSS is particular about the order that you do things. "Border" is handling ALL of the border angles, including border-top. So when you do "border-top" first, you set it and then you do "border" which overwrites the previous change because it's also setting the "border-top" property. Hope that helps! Always think about your order and think about it as if you gave someone a list of tasks to complete and they must complete them in order. So if you tell them to paint the wall blue and the next task is to paint that same wall red, in the end the wall will be red instead of blue.
29th Mar 2018, 2:57 PM
Fata1 Err0r
Fata1 Err0r - avatar
0
No
23rd Jul 2019, 10:54 AM
Yakubu Aliyu MUHAMMAD