Ultimate CSS shortcut for specifying borders needed
Needing help for some homework. I hope someone can help me out as I have tried all combi开发者_JS百科nations with not much success. I've been asked to simplify the following:
border-top: 1px solid #8B8BA2;
border-left: 1px solid #8B8BA2;
border-bottom: 1px solid #8B8BA2;
Anyone have any great ideas. I did try the following but it didn't seem to work:
border: 1px solid none solid solid #8B8BA2;
Hope someone out there can help.
Mari
Specifying the border
attribute let's you specify all borders at once. Since three out of four are the same, specify the border for all sides, and then remove the border for the one it doesn't apply to:
border: 1px solid #8B8BA2;
border-right: 0;
As an addition to SeanA's answer (+1), - if this is for homework you might be being asked if you actually know the shorthand border order.. so while the above works too, this might be the answer they're after.
border: 1px solid #8B8BA2;
border-width: 1px 0 1px 1px;
the first declares all borders, the second zero's the "right" border, using the four sided notation.. border (and margins and padding) are written Top - Right - Bottom - Left
- TRBL and the word used to remember this is "TRouBLe" or you can just think clockwise :)
精彩评论