For background-size, we can use percentage, setting the width and height of the background image in percent of the parent element. Now if the html goes like this:
<section>
<p>Background-size by percentage.</p>
</section>
and I set up background image for <p>
. Now which one is the parent element of the background image, <p>
or <section>
? Thanks.
Parent element means the background image's parent. It's <p>
.
Try to set different width on <p>
and <section>
, like width: 500px
and width: 1000px
You will get it.