Summary
I want to create an element where the date is centered, and on the left and right sides, there should be a line (like <hr>
) filling the empty space.
Sample (what I would like to create)
My attempt (code snippet)
I have tried several different approaches to achieve this, but my knowledge is still limited. Could you please explain how I could accomplish my goal?
.post-container .blog-post .post-date hr {
color: #212931;
width: 30%;
vertical-align: middle;
}
.post-date .right {
position: absolute;
right: 0;
top: 0;
margin-right: 5%;
}
.post-date p {
font-size: 20px;
display: inline-block;
position: absolute;
transform: translateY(-15px);
color: #212931;
margin: 0 auto;
}
<div class="post-date">
<hr class="left" />
<p>2023/06/25</p>
<hr class="right" />
</div>