W3C home > Mailing lists > Public > www-style@w3.org > June 2013

Re: lazy loading for images via css

From: Sebastian Zartner <sebastianzartner@gmail.com>
Date: Fri, 28 Jun 2013 08:01:06 +0200
Message-ID: <CAERejNY7bCHOu9SmP8C7wfqsGb5eOOfkBB+BS3zUzeD3qpi3Ng@mail.gmail.com>
To: Felipe Nascimento de Moura <felipenmoura@gmail.com>
Cc: www-style <www-style@w3.org>
>
> article img{
>     loading-type: postponed;
> }
>
Disregarding the usefulness of your suggestion, the requests related to
<img> tags are initiated after reading the HTML, so this is not
controllable via CSS. (Correct me somebody if I'm wrong.)
To postpone image loading of images defined via <img>, you would therefore
have to add an attribute to the <img> tag like this:

<img src="mygreatestphoto.jpg" alt="My greatest photo!" postponed/>

Your idea could work for URLs defined within CSS, though. E.g.:

article {
    background-image: url(mygreatestphoto.jpg) postponed;
}

or

article {
    background-image: url(mygreatestphoto.jpg postponed);
}

Sebastian
Received on Friday, 28 June 2013 06:01:53 UTC

This archive was generated by hypermail 2.3.1 : Friday, 28 June 2013 06:01:57 UTC