Shino
5
Q:

center a div in css

.container {
  display: flex;
  justify-content: center;
  align-items: center;
}
8
  position: absolute;
  left: calc(50% - 100px);
1

.center
{

  margin: auto;

   
width: 50%;

   
border: 3px solid green;
  padding: 10px;

} 
4
<!-- 
	 Simple CSS CENTER DIV Example
 	 
	 * See Fiddle in link for PoC *
-->

<div class="parent">
  <div class="child">
    <p>
      Eh Up Me Duck!
    </p>
  </div>
</div>

<style>
.parent {
  /* Just for aesthetics: see fiddle */
  border: 1px solid black;
  padding: 2px;
}

.child {
  border: 1px solid red;
  width: 50%;
  
  /* This is where the magic happens */
  margin-left: auto;
  margin-right: auto;
  /**********************************/
}

p {
  /* As you do */
  text-align: center;
}
</style>
8
.shadoww .prt {
    margin: 0 auto;
}
-1

New to Communities?

Join the community