what is the shortest way to write this border css properties?
i have div called "commentbox"
and i want to have border solid
color #ccc, but i want the right side, not to bordered.
so only left, top and buttom of the div should be covered with borederlines. thank开发者_StackOverflow中文版s
probably
.commentbox{
border: solid #ccc;
border-right: none;
}
This would work:
.commentbox {
border: 2px solid #ccc;
border-right: none; /* though some amend this to: '0 none transparent' */
}
Effectively you declare the width
, style
and color
of the border in the shorthand first rule, and then assign a style
of none
(although you could use border-right-width: 0
or border-right-color: transparent
to achieve the same result in compliant browsers).
You can do this:
.commentbox{
border:1px solid color #ccc;
border-right:none;
}
The rule border:1px solid color #ccc;
will apply border to all four sides but later rule border-right:none;
will remove it from right
side leaving you with three sides of the border.
You can read this post on CSS-Trick.Com:
- Three-Sided Border
精彩评论