Horje
how to center a div element Code Example
how to center a div in css
.center {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
center a div
.container{
	margin: 0 auto;
    display: flex;
    align-items: center;
}
how to center a div element
/*ADD MARGIN auto to left and right*/
.box1{
    width:80%;
    margin:0 auto;
}
how to center a div
.div {
	width: 80%;
    margin: auto;
}
how to center div
<!DOCTYPE html>
<html>
<head>
<style>
.center {
  margin: auto;
  width: 80%;
  border: 3px solid #73AD21;
  padding: 10px; # deals with margins within the element itself
  margin: 20px; # deals with area around outside of element
}
</style>
</head>
<body>

<h2>Center Align Elements</h2>
<p>To horizontally center a block element (like div), use margin: auto;</p>

<div class="center">
  <p><b>Note: </b>Using margin:auto will not work in IE8, unless a !DOCTYPE is declared.</p>
</div>

</body>
</html>
how to center a div
margin:auto




Css

Related
how to stretch picture with website css Code Example how to stretch picture with website css Code Example
css top padding Code Example css top padding Code Example
input uppercase with css Code Example input uppercase with css Code Example
style rule that expands the element to cover any floating content within the element Code Example style rule that expands the element to cover any floating content within the element Code Example
download css from website Code Example download css from website Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8