+ 4
Centre an image in css
How to align an image to the centre of site in css?
5 Respuestas
+ 15
* {
text-align:center;
vertical-align:middle;
line-height:100%;
}
(does this work??)
+ 5
ok thanks you guys
+ 3
html:
<img src="yourimage.png" class="picture">
css:
.picture{
max-width: 500px; /* or that you want*/
margin-left: auto;
margin-right: auto;
}
+ 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;
}
0
img.center {
display: block;
margin-left: auto;
margin-right: auto;
}