CSS - allow div to exit its parent

I have been looking a lot for a way to allow a div to exit its parent.

The parent has float: right, and I try to click it to show / hide the child, but the child shows / hides after the div. I would like to make this a “sticking out” parent div.

Thank!:)

+3
source share
3 answers

Your explanation is not very clear, but here is a demonstration of the right-aligned parent div with a child div that sticks out. Hope this is what you are looking for :)

#parent {
  width: 200px;
  height: 200px;
  background-color: #FF0000;
  float: right;
  position: relative;
}
#child {
  width: 300px;
  height: 100px;
  background-color: #00FF00;
  position: absolute;
  right: 0;
}
<div id="parent">
  Parent
  <div id="child">
    Child
  </div>
</div>
Run codeHide result
+2
source
+2

overflow: visible; the parent should do the trick - be careful if you have one and the sizes are set!

+1
source

All Articles