How can I set a css border on one side only?

前端 未结 6 1929
既然无缘
既然无缘 2021-01-31 00:59

For a given div I would like to only display a border on the left, right, top, or bottom side.

Currently I have the following, which puts a border on all s

6条回答
  •  眼角桃花
    2021-01-31 01:50

    You can specify border separately for all borders, for example:

    #testdiv{
      border-left: 1px solid #000;
      border-right: 2px solid #FF0;
    }
    

    You can also specify the look of the border, and use separate style for the top, right, bottom and left borders. for example:

    #testdiv{
      border: 1px #000;
      border-style: none solid none solid;
    }
    

提交回复
热议问题