While working on the box model portion of the Learn CSS course I noticed that I couldn’t pass a step if I didn’t declare the border color to be white even though the h1 element the border was wrapped around was already declared white. I’m curious if there is any benefit or reason for declaring both the h1 element and the border of that element to be white instead of saving time and letting the border inherit the color of the h1 element if I wanted them to both be the same color?
It’s true that border color is derived from the foreground color. The alternative is declare the style and width and let the color come from the foreground of the element it wraps…
/*border: 3px solid white;*/ border-style: solid; border-width: 3px;
though some might find the shorthand declaration simpler to write and to read. Granted there is some reduncancy but it is a fair trade-off.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.