<h2>margin-left: auto</h2>
<div class="wrap">
  <div class="box margin-left">margin-left: auto</div>
</div>
<h2>margin-right: auto</h2>
<div class="wrap">
  <div class="box margin-right">margin-right: auto</div>
</div>
<h2>margin: auto</h2>
<div class="wrap">
  <div class="box margin-auto">margin: auto</div>
</div>
.wrap{
  border:1px solid;
}
.box{
  width:200px;
  padding:40px 0;
  text-align:center; 
  background-color:lightpink;
  color:#333;
}
.margin-left{
  margin-left: auto;
}
.margin-right{
  margin-right: auto;
}
.margin-auto{
  margin: auto;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.