Reputation: 51
I use this code to center a section : (This is the only way I can do to center this section )
<div class="clock-section">
<h5 id="clock-title">We are coming really soon</h5>
<hr class="hr" id="cdhr">
</div>
CSS :
.clock-section {
position:absolute;
top:50%;
left:50%;
transform:translate(-50%, -50%);
}
The section is centered well , but the problem is that the text gets blurry and also the hr looks ugly and blurry,
I have tried all methods like webfont smooth etc, but didn't work at all ! :(
Can anyone help me ?
Thanks ...
Upvotes: 5
Views: 1122
Reputation: 363
I have tried all of solutions, sometimes they worked sometimes didn't. Finally I gave up to use this method to center elements. Instead of using transform try this :
width: 50vw;
height:50vh;
position: fixed;/*or absolute*/
margin:25vh 25vw;
This code centers the main element on screen. You can use flex or another solution to center inside elements...
Upvotes: 1