2
My dear, I have always used the tactic below to centralize my elements vertically that are contained in something with position Absolute, but for a while now it is no longer working, the element simply does not centralize but passes much of what would be the center.
I’m doing something wrong or this method no longer funf more?
position: relative
top: 50%;
transform: translateY(-50%);
I’m doing like this:
.content {
position: relative;
height: 100%;
width: 100%;
}
.content .central {
width: 60%;
height: 100%;
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 50%;
transform: translateX(-50%);
}
<section class="content">
<div class="central">
<h1><b>Texto de teste</b></h1>
</div>
</section>
Could make a [mcve] demonstrating the problem?
– Woss
You can put the full html and css
– Marcelo Batista
I added the code to the question.
– Leonardo Henrique