25 Temmuz 2021 Pazar

HTML Img Tag

alt Alanı
Örnek
Şöyle yaparız
<img src="/static/cat.jpg" alt="Cat" />
srcset Alanı
Örnek
Şöyle yaparız
<img srcset="small-car-image.jpg 400w,
             medium-car-image.jpg 800w,
             large-car-image.jpg 1200w"

     sizes="(min-width: 1280px) 1200px,
            (min-width: 768px) 400px,
            100vw"
     
     src="medium-car-image.jpg" alt="Car">
Açıklaması şöyle
srcset attribute accepts multiple images with their respective width in pixels, and the browser uses these values to choose between provided images. In the above example, there are 3 versions of the same image in 3 different sizes

The sizes attribute defines the space that the image will take up on the screen. In the above example, the image will take up 1200px if the screen’s minimum width is 1280px.

Hiç yorum yok:

Yorum Gönder