Здесь можно что-то разместить



    Здесь можно что-то разместить



    Img Srcset Sizes Example


    Img srcset sizes example

    imgur downloader github

    Where Things Get Tricky

    So we’re telling browsers the perfect image to select. That’s great! Here’s the problem: what happens when the sizes attribute wants a bigger image than we have?

    The answer? Bad stuff. Let’s take a look:

    This time, we’re telling the browser that the image will fill the browser window up to 400px wide, after which it will always appear as 400px wide. This is the kind of thing you might see for a logo in a user-edited directory.

    We might even make sure that this image never exceeds 400px with CSS:

    img.logo {    max-width: 400px;}

    The problem is that the well-intentioned but technologically-clueless nonprofit Widgets for the World only uploaded a 200px-wide logo. What happens? The browser stretches the image to 400px wide, even though the image is only 200px wide!

    Why? Because of what we told the browser in sizes.

    The first time I ran into this, I did not expect it, but it turns out to be the intended behavior. From MDN‘s specification:

    The selected source size affects the intrinsic size of the image (the image’s display size if no CSS styling is applied).

    Here’s how that looks in practice in Chrome, Firefox, Safari, and Edge:

    Variations on the sizes attribute with a small responsive image. View full demo on CodePen.

    That image only contains 200 pixels horizontally, but the browser stretches it to 400px wide or even farther!

    Luckily, you’ll see there’s an easy “fix” there at the end: our old good friend the width attribute!



    Просмотров - 4199 / Комментариев - / Автор - admin / Добавлено - {date=d-m-Y H:i} / / Категория: Обзоры /
    4063



    Мы работаем над тем, чтобы самое новое и свежее порно видео всегда было представлено в большом количестве на нашем сайте.