Created
March 6, 2016 00:21
-
-
Save QROkes/f787b6f2edc47513d9d4 to your computer and use it in GitHub Desktop.
How to center an image (vertically & horizontally) on a simple HTML web page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="es-MX"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Tituo de la pagina</title> | |
<meta name="description" content="Agregar descripcion"> | |
<style type="text/css"> <!--Fix width, height and margin --> | |
img { | |
width: 600px; | |
height: 340px; | |
margin-top: -170px; | |
margin-left: -300px; | |
left: 50%; | |
top: 50%; | |
position: absolute; | |
} | |
</style> | |
</head> | |
<body> | |
<img src="http://domain.com/image.jpg" alt="Agregar texto alternativo" width="600" height="340" /> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment