PROJET AUTOBLOG


shaarli-Links

Site original : shaarli-Links

⇐ retour index

[CSS] Note centrer une image dans un bloc - Le Hollandais Volant

vendredi 31 juillet 2015 à 20:57
Merci
Toujours bon à garder sous le coude.
"""
#container {
   max-height: 100%;
}

#container img {
   /* Keeps image from going outside the screen */
   max-height: 100%;
   max-width: 100%;
   /* Keeps image from beeing distorted */
   height: auto;
   width: auto;
   /* centering horizontally AND vertically */
   /* 50% of container */
   position: relative;
   top: 50%;
   left: 50%;
   /* 50% of image */
   transform: translate(-50%,-50%);
}
"""
demo : http://lehollandaisvolant.net/tout/examples/center/
(Permalink)