Reputation:
I would like to specify a top border with a width of 1px that is red. I was trying like this and it seems to work:
border-width: 1px 0px 0px;
border: 1px solid #ff0000;
However is there a way I can do this with just the one CSS statement and combine these two?
Note that I need to override a previous setting of border width so I can't just use border-top :-(
Upvotes: 0
Views: 1138
Reputation: 125640
According to CSS3 specification:
The ‘border’ property is a shorthand property for setting the same width, color, and style for all four borders of a box. Unlike the shorthand ‘margin’ and ‘padding’ properties, the ‘border’ property cannot set different values on the four borders. To do so, one or more of the other border properties must be used.
However, on your situation setting just border-top
would left other borders on default, which is none
.
Upvotes: 1