CSS CSS Layout CSS Media Queries Media Queries

Thomas Scott
Thomas Scott
5,215 Points

Next, create a new media query that targets all devices when the viewport width is 769px or wider. Inside the media quer

Not sure what I've missed here, it keeps asking if my size is correct? it is asking for 1.4rem and then 4rem.

style.css
/* Complete the challenge by writing CSS below */

@media screen and (min-width: 421px) {
 header {
   background-color: #294969;
   color: ghostwhite; 
}

@media and (min-width: 769px) {
 div #logo {
   font-size: 1.4rem;
    }
    h1 {
      font-size: 4rem;
    }
}
index.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Developer Diane's blog</title>
  <link rel="stylesheet" href="page.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <header>
    <div id="logo">Developer Diane’s Blog</div>
  </header>
  <article>
    <section class="intro">
      <h1>The verdict is in. CSS Layout is great!</h1>
      <p>I’ve been working with CSS for a while now, and I have to say, it’s pretty awesome. I love being able to separate content from presentation, and to keep all my styles in an external stylesheet.</p>
      <p>I’ve had a pretty good grasp on the basics for a while now, but I needed to learn more about how to control layout with my CSS. Understanding CSS layout meant first exploring the parts of the CSS box model.</p>
    </section>
    <section class="featured">
      <h2>The CSS Box Model</h2>
      <p>There are lots of great resources online to help you learn the CSS Box Model. I like the CSS Tricks article <a href="https://css-tricks.com/the-css-box-model/" target="_blank">The CSS Box Model</a> by Chris Coyier. To quote the author:</p>
      <blockquote>At the risk of over-repeating myself: <strong>every element in web design is a rectangular box.</strong></blockquote>
      <p>That’s right! Every HTML element is considered by the browser to be a rectangular box.</p>
      <p>The CSS Box Model consists of four properties: content, padding, border, and margin. I've included a graphic from Coyier’s article to illustrate this principle.</p>
      <p class="clear">It’s pretty easy to understand the Content portion of the box model. The content is whatever your HTML consists of. It could be a paragraph full of text, or a bulleted list, or an image.</p>
      <p>Beginning developers may have some trouble keeping the other parts of the box model straight, so let’s examine them one by one.</p>
    </section>
    <footer>©2020 Developer Diane.</footer>
</body>
</html>

1 Answer

Peter Vann
Peter Vann
36,049 Points

Hi Thomas!

Sometimes the challenge test program is a little troublesome.

This passes both tasks:

/* Complete the challenge by writing CSS below */

@media screen and (min-width: 421px) {
  header {
    background-color: #294969;
    color: ghostwhite;
  } /*** You were missing this curly brace, for one thing... ***/
}

@media screen and (min-width: 769px) { /*** The test program required the word screen here to pass!?! ***/
  #logo { /*** You don't need div here - #logo is sufficient ***/
     font-size: 1.4rem;
  }
  h1 {
    font-size: 4rem;
  }
}

I hope that helps.

Stay safe and happy coding!

redacted -jn

Bruno Carvalho
seal-mask
.a{fill-rule:evenodd;}techdegree
Bruno Carvalho
Front End Web Development Techdegree Student 8,189 Points

Life saver! I've been looking at my code for a while trying to figure out, looking for online help and nothing until I found your post! Feel like a found a treasure :) Thanks a lot Peter!