Prority clip:;
allows you to specify a rectangle to cut out an absolutely positioned element. The rectangle is specified in four coordinates, all starting from the upper left corner of the element to be cut.
img {
position: absolute;
clip: rect(0px,60px,200px,0px);
}
The overflow:;
property specifies what happens if the content overflows the "/ em box" container "of an element.
This property, when specified, is used to add scrollbars when the content of an element is too large to fit in a specified area or to cut / limit the contents of a box when using overflow:hidden;
.
.elemento {
width: 150px;
height: 150px;
overflow: scroll; /* adiciona automaticamente uma barra de rolagem/scroll ao elemento se o conteúdo for maior, dando a possibilidade de fazer scroll para ver o resto do conteúdo */
}
The only case where these properties work similarly is when using overflow:hidden;
to crop images as you can see in this example below:
.clipImg {
width: 100%;
height: auto;
position: absolute;
clip: rect(0px,500px,200px,0px);
}
.clipOverflow {
width: 500px;
height: 200px;
overflow: hidden;
}
.clipOverflow img {
width: 100%;
}
<div class="clipOverflow">
<img src="http://c1.staticflickr.com/1/624/32968186751_a913f86f82_c.jpg"></div><imgclass="clipImg" src="http://c1.staticflickr.com/1/624/32968186751_a913f86f82_c.jpg">
But as we can see in this example, while% literally clipped a portion of the image, already in clip
we would have to work the code better to get this same effect of overflow:hidden;
but in the end the concept is the same as using clip
in this way. The image only looks more docked because we gave% color to the image to respect the container parent overflow:hidden;
box.