Skip to content

Instantly share code, notes, and snippets.

@UlyssesAlves UlyssesAlves/README.md
Last active Jun 29, 2016

Embed
What would you like to do?
Como centralizar uma <div> dentro de outra <div> usando CSS.
#divExterna {
width: 100%;
}
/* Primeira alternativa para centralizar a DIV. */
#divInterna {
width: 50%;
margin: 0 auto;
background-color: yellow;
}
/* Segunda alternativa para centralizar a DIV. */
#divInterna {
display: table;
margin: 0 auto;
background-color: yellow;
}
<html>
<head>
<title>Centralizando uma DIV dentro de outra DIV</title>
<link rel="stylesheet" type="text/css" href="centralizando_divs.css"></link>
</head>
</body>
<div id="divExterna">
<div id="divInterna">
Conteúdo da DIV interna.
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.