I am looking for a way to create an incomplete square with borders with some text and a background with pure css. Here is what I am trying to achieve:
<
Well, go with the above answers, I recommend using pseudo
elements to achieve this effect.
But There is another way to accomplish this without using pseudo-elements.
Here is how you should do this.
.row{display:table;table-layout:fixed;}
.col{display:table-cell;}
.row{width:250px; margin: auto;}
.mid.row > .col{ height: 100px; }
.col{ text-align: center;}
.top.col, .bottom.col{
border-top: 1px solid black;
border-left: 1px solid black;
border-right: 1px solid black;
height: 50px;
}
.bottom.col{
border-top: 0;
border-bottom: 1px solid black;
}
.mid.row > .col{
border-left: 1px solid black;
border-right: 0;
vertical-align: middle;
text-align: right;
}
.mid.row > .col span{
margin-right: -30px;
max-width: 300px;
}
Hey you can achieve this without using pseudo elements :)