Border Corners: Triangle

前端 未结 3 1697
不知归路
不知归路 2021-01-20 04:44

Is it possible to get rid of the \"triangle\" shape in the border corners? (when using different color borders)

See this example:

http://jsfiddle.net/GLsqV/

3条回答
  •  面向向阳花
    2021-01-20 05:00

    Not everywhere with a single element. (Actually, the default triangular shape of borders is what makes great things possible: The Shapes of CSS)

    However, what you are asking for is easily possible everywhere with another child element.

    CSS:

    .borders {
      width: 520px;
      height: 500px;
      border-top: 10px solid red;
      border-bottom: 10px solid green;
    }
    
    .borders2 {
      background: #efefef;
      width: 500px;
      height: 500px;    
      border-left: 10px solid black;
      border-right: 10px solid black;
    }
    

    ​ HTML:

    With these values, the outer DIV's border-box will still have a size of 520×520 pixels.

    See also this fiddle.

提交回复
热议问题