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/
One option using generated content:
.borders {
width:500px;
height:500px;
position: relative;
background:#efefef;
border-top:10px solid red;
border-bottom:10px solid green;
}
.borders::before,
.borders::after {
content: '';
position: absolute;
width: 10px;
top: 0;
bottom: 0;
background-color: #000;
}
.borders::before {
left: 0;
}
.borders::after {
right: 0;
}
JS Fiddle demo.
Or with nested HTML (if you really must):
.borders {
width:500px;
height:500px;
position: relative;
background:#efefef;
border-top:10px solid red;
border-bottom:10px solid green;
}
.borders .innerBorder{
content: '';
position: absolute;
width: 10px;
top: 0;
bottom: 0;
background-color: #000;
}
.borders .left {
left: 0;
}
.borders .right {
right: 0;
}
JS Fiddle demo.
And a single-nested-element solution in which the left, and right, border-color
is the background-color
of the wrapping element, and the width controlled by the margin
of the descendant:
CSS:
.borders {
width:500px;
height:500px;
background-color: #000;
border-top:10px solid red;
border-bottom:10px solid green;
}
.borders .inner {
background-color: #efefef;
height: 100%;
margin: 0 10px;
}
JS Fiddle demo.