I don’t know how to properly use the ‘transform: translate() rotate();’ property. I just adjusted the values of ‘translate()’ manually - trial and error - while making this.
Is there a better or proper way to make this object? Is there a specific formula for the translate values?
This is how I created this object.
.box-out {
position: absolute;
margin: auto;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 400px;
height: 400px;
background-color: #e3da00;
border: 2px dashed #a43741;
}
.box-in {
position: absolute;
left: 50px;
top: 50px;
width: 300px;
height: 300px;
background-color: #21BD00;
border: 2px dashed #522B72;
}
.diagonal-1 {
width: 424px;
transform: translate(-62px, 149px) rotate(45deg); /* Q1-1 */
border-top: 2px dashed #e3da00;
z-index: initial;
}
.diagonal-2 {
width: 424px;
transform: translate(-62px, 149px) rotate(-45deg); /* Q1-1 */
border-top: 2px dashed #e3da00;
z-index: initial;
}
.circle{
position: relative;
border-radius: 50%;
width: 100px;
height: 100px;
background-color: #6E6E6E;
margin: 95px auto;
z-index: 1;
}
<body>
<div class="box-out">
<div class="box-in">
<div class="diagonal-1"></div>
<div class="diagonal-2"></div>
<div class="circle"><div>
</div>
</div>
</body>
Thanks in advance.