开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜