CSS – Center Content

Table of Contents

Source

Starter Code

Center text

				
					<div class="container">
  <p>Hello, (centered) World!</p>
</div>
				
			
				
					p {
  text-align: center;
}
				
			

Center with margin

				
					<div class="container">
  <div class="child"></div>
</div>
				
			
				
					.child {
  ...
  margin: 0 auto;
}