+ 1
How do i centralize a div element in html?
HTML: <body> <div id = 'ss'> </div> </body> CSS: #ss { background-color: #000022; position: relative; width: 40px; height: 40px; left: 50%; } 50% doesn't work because i have to do 50% - ss.width / 2 but that doesn't work in css. Align doesn't work either. So how do i do it?
3 Respostas
+ 4
width: calc(50% - (40px / 2));
+ 2
There are many ways...
https://css-tricks.com/centering-css-complete-guide/
0
There are many ways in css to achieve it.
If this one helps☺️☺️.
https://code.sololearn.com/Wv8bTV92Qz95/?ref=app