"Mozilla splash page" assessment

(Chris Mills) #185

Yes, this is because of the max-width: 100% CSS.

  1. The srcset provides a hint to the browser as to what image would be most suitable to load based on the browser’s viewport width, device resolution, etc. Those “w” values are not exact image dimensions - they are hints as to the likely size of the image slot at different viewports.
  2. The browser then makes a choice and loads the chosen image.
  3. Once loaded, the image will be shown at it’s “true” size, unless some CSS comes into play and changes what the display size ends up being. In this case, max-width is making the images’ width be constrained to 100% of the width of their parent elements, so they are not shown at their true size.

Does that help?

(Csarami) #186

I did the panda image like this:

                <source media="(max-width: 599px)" srcset="originals/red-panda-CloseShut.jpg">
                <source media="(min-width: 600px)" srcset="originals/red-panda.jpg">
                <img src="originals/red-panda.jpg" alt="panda">

But I see this one works ( copied from solution)

          <source media="(max-width: 600px)" srcset="red-panda-portrait-small.jpg">
          <img src="red-panda-landscape.jpg" alt="a red panda">

It seems the latter one is more efficient. Isn’t it?

(Chris Mills) #187

Yeah — in this case you don’t really need two <source> elements, as the image referenced in the <img src=""> is loaded by default if the media query test does not pass.

The smaller image is only loaded if the viewport width is 600px or less.

(Clemente del Río) #188

just finished the Mosilla splash page Assessment, had fun doing it!
Please comment.

<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>Mozilla splash page</title>
    <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
      /* header and body setup */

      html {
        font-family: 'Open Sans', sans-serif;
        background: url(pattern.png);

      body {
        width: 100%;
        max-width: 1200px;
        margin: 0 auto;
        background-color: white;
        position: relative;

      /* Header styling */

      header {
        height: 150px;

      header img {
        width: 100px;
        position: absolute;
        right: 32.5px;
        top: 32.5px;

      h1 {
        font-size: 50px;
        line-height: 140px;
        margin: 0 0 0 32.5px;

      /* main section and video styling */

      main {
        background: #ccc;

      article {
        padding: 20px;

      h2 {
        margin-top: 0;

      p {
        line-height: 2;

      iframe {
        float: left;
        margin: 0 20px 20px 0;
        max-width: 100%;

      /* further info links */

      .further-info {
        clear: left;
        padding: 40px 0;
        background: #c13832;
        box-shadow: inset 0 3px 2px rgba(0,0,0,0.5),
                    inset 0 -3px 2px rgba(0,0,0,0.5);

      .further-info a {
        width: 25%;
        display: block;
        float: left;

      .further-info img {
        max-width: 100%;

      .clearfix {
        clear: both;

      /* Red panda image */

      .red-panda img {
        display: block;
        max-width: 100%;
      <!-- insert <img> element, link to the small
          version of the Firefox logo -->
        <img src="firefox-logo-120w.png" alt="firefox logo: a fox and the world">

        <!-- insert iframe from youtube -->
        <iframe width="400" height="225" src="https://www.youtube.com/embed/ojcNcvb1olg" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
        <h2>Rocking the free web</h2>

        <p>Mozilla are a global community of technologists, thinkers, and builders, working together to keep the Internet alive and accessible, so people worldwide can be informed contributors and creators of the Web. We believe this act of human collaboration across an open platform is essential to individual growth and our collective future.</p>

        <p>Click on the images below to find more information about the cool stuff Mozilla does. <a href="https://www.flickr.com/photos/mathiasappel/21675551065/">Red panda picture</a> by Mathias Appel.</p>

      <div class="further-info">
        <!-- insert images with srcsets and sizes -->
        <a href="https://www.mozilla.org/en-US/firefox/new/">
          <img srcset="firefox-logo-120w.png 120w, firefox-logo-400w.png 400w" sizes="(max-width:480px) 120px" src="firefox-logo-400w" alt="Firefox logo, a fox and the world">
        <a href="https://www.mozilla.org/">
          <img srcset="mozilla-dinosaur-120w.png 120w, mozilla-dinosaur-400w.png 400w" sizes="(max-width:480px) 120px" src="mozilla-dinosaur-400w.png" alt="a red dinosaur, the mosilla one">
        <a href="https://addons.mozilla.org/">
          <img srcset="firefox-addons-120w.jpg 120w, firefox-addons-400w.jpg 400w" sizes="(max-width:480px) 120px" src="firefox-addons-400w.jpg" alt="puzzle pieces forming the firefox logo">
        <a href="https://developer.mozilla.org/en-US/">
          <img src="mdn.svg" alt="a geometric waving flag with a t-rex head vain in the center">
        <div class="clearfix"></div>

      <div class="red-panda">
        <!-- insert picture element -->
          <source media="(max-width:599px)" srcset="red-panda-croped-600w.jpg">
          <source media="(min-width:600px)" srcset="red-panda-1200w.jpg">
          <img src="red-panda-1200w.jpg" alt="a red panda chilling like money ain`t a thang">


(Chris Mills) #189

Hello again!

I have checked your work, and it looks pretty good. The main feedback I had was that the images don’t seem to load, but this is not a big deal — I’m assuming you just have your assets named differently to our example?

I’d also like to invite you to check your code against the marking guide, and our finished example:

(Sharon) #190


I have completed the Mozilla splash page problem.

Please review my solution.

Thank you,