CSS Layout How to - Place children element to right bottom corner of its parent








Question

We would like to know how to place children element to right bottom corner of its parent.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.my {<!--from  w  ww . j ava 2  s  . com-->
  width: 575px;
  margin: 8px auto;
  background: #EEE;
  padding: 8px;
  position: relative;
}

.my >div {
  position: relative;
  display: inline-block;
}

.gameimage {
  width: 78px;
  height: 75px;
  background: yellow
}

#staff {
  width: 50px;
  height: 50px;
  position: absolute;
  bottom: 0;
  right: 0;
  background: Red;
}
</style>
</head>
<body>
  <div class="my">
    <div>
      <div class="gameimage"></div>
      <div id='staff'></div>
    </div>
  </div>
</body>
</html>

The code above is rendered as follows: