If I have a div:
<div></div>
And some css to give it a color:
div {
width: 200px;
height: 200px;
padding: 20px;
background-color: red;
}
Then it colors the padding area as well. Is there a way to avoid this without changing the border or margin properties?
You can use
background-clip: content-box;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With