Really vague question, I know, but I don't know how to describe them... Basically, I want these:
I'm talking about the corner things in red. What's the easiest way to achieve this? Obviously, you could just make individual divs in those shapes, but I feel like getting them in the positions you want, even when everything re-sizes and stuff, would be a pain. Is that the only way?
To get a perfectly square corner, you want to aim for a measurement ratio of 3:4:5. In other words, you want a three-foot length on your straight line, a four-foot length on your perpendicular line, and a five-foot length across. If all three measurements are correct, you'll have a perfectly square corner.
Here an approach that might be useful. Add two pseudo elements, one with top and bottom borders and the second with left and right borders of a certain color (white) such that they "white out" the original border (blue in this case).
This approach is pure CSS and no extra mark-up is involved.
div {
font-size: 4.00em;
padding: 40px;
border: 2px solid blue;
display: inline-block;
position: relative;
}
div:after {
content: '';
display: block;
border-left: 2px solid white;
border-right: 2px solid white;
position: absolute;
height: 50%;
left: -2px;
right: -2px;
top: 25%;
bottom: 25%;
}
div:before {
content: '';
display: block;
border-top: 2px solid white;
border-bottom: 2px solid white;
position: absolute;
height: 100%;
left: 25%;
right: 25%;
top: -2px;
bottom: -2px;
}
<div>Box Text</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With