Page 84 - HTML5
P. 84

Chapter 20: Images




        Syntax



            •  <img src="" alt="">


        Parameters



          Parameters     Details


          src            Specifies the URL of the image

                         Images to use in different situations (e.g., high-resolution displays, small
          srcset
                         monitors, etc)


          sizes          Image sizes between breakpoints


          crossorigin    How the element handles crossorigin requests

          usemap         Name of image map to use


          ismap          Whether the image is a server-side image map

                         Alternative text that should be displayed if for some reason the image could
          alt
                         not be displayed


          width          Specifies the width of the image (optional)


          height         Specifies the height of the image (optional)


        Examples



        Creating an image


        To add an image to a page, use the image tag.


        Image tags (img) do not have closing tags. The two main attributes you give to the img tag are src,
        the image source and alt, which is alternative text describing the image.


         <img src="images/hello.png" alt="Hello World">


        You can also get images from a web URL:


         <img src="https://i.stack.imgur.com/ALgZi.jpg?s=48&g=1" alt="StackOverflow user Caleb
         Kleveter">




        https://riptutorial.com/                                                                               68
   79   80   81   82   83   84   85   86   87   88   89