Skip to main content
daveharr1s0n
Inspiring
Mar 3, 2017 11:41 PM UTC
Answered

How do I use different logo sizes (responsive) on Skeleton format?

Hello all,

I have been trying to learn how to put together responsive sites using the Skeleton boilerplate. Skeleton: Responsive CSS Boilerplate​ It's going well, pretty straight forward, but I'm trying to figure out how to code for different versions of a logo for different orientations and devices. Anyone know how to do that? Media queries, I would imagine, but how does one go about changing or adding to the existing CSS?

Any ideas? Thanks!

Dave

    This topic is closed to new replies. Start a new post to keep the conversation going.
    BenPleysier
    BenPleysierCorrect answer
    Community Expert
    Mar 4, 2017 12:09 AM UTC

    Media queries are useful when using background images as in

    /* For width smaller than 400px: */

    body {
        background-image: url('img_smallflower.jpg');
    }

    /* For width 400px and larger: */

    @media only screen and (min-width: 400px) {
        body {
            background-image: url('img_flowers.jpg');
       
    }
    }

    For foreground images it is best to use  <picture>-<source>-<img> combination as in

    <picture>

      <source srcset="img_smallflower.jpg" media="(max-width: 400px)">

      <source srcset="img_flowers.jpg">

      <img src="img_flowers.jpg" alt="Flowers">

    </picture>

    The examples were copied from Responsive Web Design Images. If you Google the subject 'picture element' you will come across articles like Built-in Browser Support for Responsive Images - HTML5 Rocks

    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!

    9 replies

    BenPleysier
    Community Expert
    BenPleysierCommunity ExpertCorrect answer
    Community Expert
    Mar 4, 2017 12:09 AM UTC

    Media queries are useful when using background images as in

    /* For width smaller than 400px: */

    body {
        background-image: url('img_smallflower.jpg');
    }

    /* For width 400px and larger: */

    @media only screen and (min-width: 400px) {
        body {
            background-image: url('img_flowers.jpg');
       
    }
    }

    For foreground images it is best to use  <picture>-<source>-<img> combination as in

    <picture>

      <source srcset="img_smallflower.jpg" media="(max-width: 400px)">

      <source srcset="img_flowers.jpg">

      <img src="img_flowers.jpg" alt="Flowers">

    </picture>

    The examples were copied from Responsive Web Design Images. If you Google the subject 'picture element' you will come across articles like Built-in Browser Support for Responsive Images - HTML5 Rocks

    Translate
    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
    pziecina
    Legend
    Mar 4, 2017 10:34 AM UTC

    Just like to say thank you for posting this Ben

    Translate
    BenPleysier
    Community Expert
    Community Expert
    Mar 4, 2017 11:04 AM UTC

    Thank you for the feedback.

    In an endeavour to reduce file sizes and the number of HTTP requests, all in an effort to reduce band width, I initially overlooked the importance of images. I have now come to the conclusion that compressing a CSS file to save a few KB's is nothing compared to the savings to be had when using correct image optimisation and deployment.

    There is still a lot of work done in this area, especially SVG's

    Have you had a look at WebP - Wikipedia?

    Translate
    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!