HTML Image Background & Picture

Background Image on a HTML element

A background image can be specified for almost any HTML element.
To add a background image on an HTML element, use the HTML style attribute and the CSS background-image property

        <style> {
            background-image: url('image-link');
        }
        </style>
        
        <div class="bg> </div>




Picture

The HTML <picture> contains zero or more <source> elements and one <img> element to offer alternative versions of an image for different display/device scenarios.

        <picture>
            <source srcset="/misc/img1.jpg" media="(min-width: 800px)" >
            <img src="/misc/picture.jpg" >
        </picture>