+ 4

Centre an image in css

How to align an image to the centre of site in css?

10th Feb 2017, 8:06 PM
Samuel Šúr
Samuel Šúr - avatar
5 Respuestas
+ 15
* { text-align:center; vertical-align:middle; line-height:100%; } (does this work??)
10th Feb 2017, 9:13 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 5
ok thanks you guys
11th Feb 2017, 7:58 AM
Samuel Šúr
Samuel Šúr - avatar
+ 3
html: <img src="yourimage.png" class="picture"> css: .picture{ max-width: 500px; /* or that you want*/ margin-left: auto; margin-right: auto; }
10th Feb 2017, 10:06 PM
Barbér Máté
Barbér Máté - avatar
+ 1
Align all content to center, horizontaly and veticaly: body, html { height:100% } html { display:table; table-layout:fixed; } body { display.table-cell; text-align:center, vertical-align:center; }
11th Feb 2017, 2:43 AM
visph
visph - avatar
0
img.center { display: block; margin-left: auto; margin-right: auto; }
10th Feb 2017, 9:19 PM
EMMANUEL NUOTAH TUONUO DERY
EMMANUEL NUOTAH TUONUO DERY - avatar