In another question I asked before, a user gave me an example of how I could perfectly leave a html button on the screen.
It was in this question: How to position a button anywhere on the screen in html
He simply did:
#centralizar{
position:absolute;
top:50%;
left:50%;
transform: translate(-50%, -50%)
}
But I tried to center three buttons below, starting from the same pattern, but it does not work ...
From what I saw in the doc, translate changes the position of an object on the screen from the multiplication of the object's position matrix by a vector. In that case, I need to have the position information in pixels to be able to do this calculation, and have an idea of what translate to apply, right? Or it has an easier way.
Here is my code:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#centralizado1 {position:absolute; top=46%; left=50%; transform:translate(-46%, -50%)}
#centralizado2 {position:absolute; top=50%; left=50%; transform:translate(-50%, -50%)}
#centralizado3 {position:absolute; top=54%; left=50%; transform:translate(-54%, -50%)}
</style>
<body>
<div id="centralizado1">
<button >A</button>
</div>
<div id="centralizado2">
<button>B</button>
</div>
<div id="centralizado3">
<button>C</button
</div>
</body>
</html>