Square brackets with CSS

后端 未结 5 1907
花落未央
花落未央 2021-02-14 22:36

I wish to create a [ and ] bracket just with CSS. Is there a way to specify the top and bottom border (Without slicing the image) so it looks like a br

5条回答
  •  醉话见心
    2021-02-14 23:31

    Not directly, but you can do this instead: HTML:

    Div content

    CSS:

    .wrapper{
        border-bottom: 2px solid #FF0000;
        border-top: 2px solid #FF0000;
        height: 100px;
        width: 300px;
    }
    .stick{
        border-left: 2px solid #FF0000;
        height: 33%;
    }
    .empty{
        height: 34%;
    }
    .content{ float: left }
    .left{ float: left; height: 100%; }
    .right{ float: right; height: 100%; }
    .clear{ clear: both }
    

    Demo: http://jsfiddle.net/Q8g4F/

提交回复
热议问题