首页htmlchildren_parentCSS Layout - 如何将子对象与父对象的左上角对齐...

CSS Layout - 如何将子对象与父对象的左上角对齐...

我们想知道如何将子对象与父对象的左上角对齐。...

<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#wr {
  height: 400px;
  width: 100%;
  margin: 50px auto;
  border: 1px solid black;
  position: relative;
}

#con_top {
  height: 40px;
  margin: 5px;
  border: 1px solid red;
  background:#EEE;
}

#con_bottom {
  background:#AAA;
  border: 1px solid blue;
  margin: 5px;
  position: absolute;
  top: 45px;
  bottom: 0;
  left: 0;
  right: 0;
}
</style>
</head>
<body>
  <div id="wr">
    <div id="con_top"></div>
    <div id="con_bottom"></div>
  </div>
</body>
</html>