Background image not showing without text on it
background image is not showing for column col-md-8 when i place text on it it displays only then . If i set height and width it is visible but i want to fit the image properly so that it takes 100 percent of height and width of div .check the images
3 Replies
background images don't control the size of the element they're on
you'll have to set the dimensions of the div some other way, or use an img tag instead of a background image
but what if i want to change image for small screen sizes
when working with background images its easy to replace image for other screen sizes
you can use srcset or the picture element to serve different sizes https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture
Or set the width and height of the div in CSS and use mediaqueries like you're probably suggesting