css border-left 50% height

前端 未结 5 1312
心在旅途
心在旅途 2020-12-29 19:28

I want the left border of my div to show only to the half of the div. The same I would like to do to my right border but is should be set from the bottom of the div to the m

5条回答
  •  既然无缘
    2020-12-29 20:03

    Good question. It's not possible using the border property.

    The only thing that comes to mind, if you can set your div's position to relative, is to use an absolutely positioned, 1 pixel wide div. Not thoroughly tested but this should work:

     

    You'd do the same on the right hand side, replacing the left property by right.

    Remember, the surrounding div needs to be position: relative for this to work. I'm not sure about whether the 50% height setting will work consistently throughout browsers - make sure you test it. You may have to resort to pixel measures if it doesn't.

提交回复
热议问题