Alright guys, I've got a problem / question and I can't find an answer to it. So let's say I've got something like this:
<div className='container'>
<div className='wrapper' style={{
width: 40,
height: 40,
backgroundColor: 'red'
}}>
<div
className='item'
style={{
width: 18,
height: 18,
backgroundColor: 'black',
}}
/>
</div>
</div>
So basically I've got a square with a square inside it within a top container
.
If I add padding to the container
the size and position of the item
will change:
As you can see the size of the item is changing [IN THE VIDEO I CHANGING THE PADDING ON THE CONTAINER] (if it's would be positioned to center then the position would change too..., as the Chrome's inspector says it's remains at 18px)
P.S.: If the item's size is an even percentage
(or px) like 10%, 20%, 30% ... 90%,
so on then the size and the position won't change. (Same if I use PX and it's equals = 10% ... 90%.. eg.: 4px, 8px, 12px...
)