简体   繁体   中英

I want to make div background image responsive

This is my div tag background image code.

<div class="text-center paira-gap-2 paira-gap-1 position-r  parallax parallax-1527413728902" style="background: url(&quot;//cdn.shopify.com/s/files/1/0611/5003/6139/files/Home2_1659f2cd-aa5a-4d18-9a93-b5955c1ec056.png?v=1648657681&quot;) 50% 8px no-repeat fixed; height: 900px;">

If someone have solution let me know.

You can make use of background-size and set it to cover to span the entire div . In addition, I recommend, placing the background to the center:

div {
  background-size: cover;
  background-position: center;
}
<div class="text-center paira-gap-2 paira-gap-1 position-r  parallax parallax-1527413728902" style="background-url: url(&quot;//cdn.shopify.com/s/files/1/0611/5003/6139/files/Home2_1659f2cd-aa5a-4d18-9a93-b5955c1ec056.png?v=1648657681&quot;) background-size: cover; background-position: center; height: 900px;">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM