+ 1

Problems with the divs

I want to get the div with the class “foto” in the center, but i cant get it, i tried some stuff like the display and the float but those didnt fix my problem, what can i do? https://code.sololearn.com/WA23A3a112a1/?ref=app

12th Jun 2021, 6:34 PM
Diego Becerril
Diego Becerril - avatar
5 ответов
0
Try this: .foto { position: absolute; margin: auto; top: 0; right: 0; bottom: 0; left: 0; }
13th Jun 2021, 3:58 AM
Coder-Rohit[{(∞)}]
Coder-Rohit[{(∞)}] - avatar
+ 1
There are many ways to this.
13th Jun 2021, 3:58 AM
Coder-Rohit[{(∞)}]
Coder-Rohit[{(∞)}] - avatar
+ 1
Make the width and height of the element fit for all devices. Don't try to make the page to scroll in X axis
13th Jun 2021, 4:00 AM
Coder-Rohit[{(∞)}]
Coder-Rohit[{(∞)}] - avatar
+ 1
Coder-Rohit[{(∞)}] yeah, thanks, i’ll try to make it responsive later, thanks for the help!
13th Jun 2021, 5:10 AM
Diego Becerril
Diego Becerril - avatar
0
U need to make container in the body first. If u want to use margin auto, u need to make any width in the container. U havent container, so if u make width for body, u can make your divs center. """"Need a width first""""
14th Jun 2021, 3:14 AM
baris