Issue
So there are these two rotated rectangles forming a V:
div {
position: relative;
left: 100px;
display: inline-block;
margin-left: 100px;
}
div::before {
content: '';
position: absolute;
transform: rotate(-45deg);
transform-origin: bottom right;
width: 20px;
height: 100px;
background: red;
}
div::after {
content: '';
position: absolute;
transform: rotate(45deg);
transform-origin: bottom left;
width: 20px;
height: 100px;
background: red;
}
<div></div>
Now how to close the gap between them? Frist I thought the key would be transform-origin. But no matter what is set there, it can't result in a isosceles V without a gap.
Solution
If you're already using transforms, you could add a translate to each and just offset them till they cross over
html {
font-size: 16px;
}
div {
position: relative;
left: 100px;
display: inline-block;
margin-left: 100px;
}
div::before {
content: '';
position: absolute;
transform: translateX(0.523em) rotate(-45deg);
transform-origin: bottom;
width: 1.25rem;
height: 6.25rem;
background: blue;
border: 2px solid blue;
}
div::after {
content: '';
position: absolute;
transform: translateX(-0.53rem) rotate(45deg);
transform-origin: bottom;
width: 1.25rem;
height: 6.25rem;
background: red;
border: 2px solid red;
}
<div></div>
Answered By - AStombaugh
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.