How to refuse to surpass the father div

1

If I have a div inside another, like this:

#padre{
width:300px;
height:300px;
background-color:lightpink;
position:absolute;
top:20%;
left:15%;
border-radius:150px;
border: 2px solid purple;
}
#hijo{
width:300px;
height:100px;
background-color:purple;
position:relative;
top:35%;
left:0%;
}
<div id="padre">
<div id="hijo"></div>
</div>

How should I make the content of div hijo , not leave div padre ?

    
asked by Eduardo Sebastian 13.09.2017 в 02:16
source

1 answer

3

You could add overflow: hidden; in div#padre , that way all the children that exceed the father are not shown.

That's how I stay.

    
answered by 13.09.2017 в 02:41