Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Trouble aligning two rectangular divs</title>
  <!-- http://redd.it/2b4wam -->
</head>
<body>
  <div class="bars">
    <div id="barOne" class="bar"></div>
    <div id="barTwo" class="bar"></div>
  </div>
</body>
</html>
 
.bars {
  position: relative;
  margin: 0 auto; /* horizontally center */
}
.bar {
  position: absolute;
  left: 0;        /* \                       */
  right: 0;       /*  - horizontally center  */
  margin: 0 auto; /* /                       */
  width: 30px;
  height: 100px;
  background-color: black;
}
#barOne {
}
#barTwo {
  -webkit-transform: translate(-23px, 85px) rotate(30deg);
  -moz-transform:  translate(-23px, 85px) rotate(30deg);
  -ms-transform: translate(-23px, 85px) rotate(30deg);
  -o-transform: translate(-23px, 85px) rotate(30deg);
  transform: translate(-23px, 85px) rotate(30deg);
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
cust0dianpro
0viewers