• what's the difference between this and flexbox?

    Great question! It gets to the heart of what's going on today.

    Last time, we learned flexbox and, for example, flex-direction: row versus column. But to make that change, we'd have to (1) edit the CSS file, (2) save it, (3) refresh the browser.

    Today, we'll have the browser switch from column to row if the screen is wide enough, based on breakpoints that we choose.

    So, the layout is dynamic or responsive.

    We can change any CSS dynamically, so colors, margins, padding, whatever, not just row/column. But mostly, we use it to change the layout.

  • Can you talk more about how to specify the order property in CSS? It only has value 0 or 2?

    You can always find out more on the MDN site. Here, they have a cool interactive demo of the order property.

  • I am a little bit confused about this:
        <meta name="viewport" content="width=device-width, initial-scale=1">
    

    What does each part mean? I see we have name = "viewport", is it like class for css? Thank you.

    I called it an incantation because, while we can certainly analyze it, in practice we just use it as is.

    However, let's address your question.

  • Can you explain the @ function? / What does the @ mean in CSS, like in @font-face and @media?

    CSS is mostly about rules like this:

    
        selector {
           prop: val;
        }
        p {
           color: purple;
        }
    
    

    However, sometime you want to do something different: giving instructions to the CSS "engine". Those are the @-rules, and are introduced with that marker.

    Two common ones are the ones you identified: fonts and media conditional rules:

    
    @font-face {
      font-family: "MyFont";
      src: url(myfont.woff2);
    }
    
    @media (max-width: 600px) {
      p { color: red; }
    }
    
    
  • For the @media screen and command in CSS, does it have a tag that it correlates to in HTML?

    No, as we just learned, it's like an if statement. IF the following condition applies, use these rules (which can then override earlier rules).

  • Both phones & tablets tend to be categorized as "mobile" devices, but often have a rather different screen ratio (even different phone models' screen dimensions vary after all). Do conventions & best practices for adapting a website for phones typically ensure a satisfactory experience regardless of screen size, or is that a separate audience that designs have to be adapted for if resources allow?

    Wow, what an interesting question! You are right that there are lots of different screen dimensions. Still, they fall into broad categories (or they can be put in those categories).

    Text can be too small to read and buttons too small to press, so at some point, we stop scaling things down and start making people scroll.

    You mentioned ratio, so it's possible to media queries to have a different layout when the screen is in landscape mode versus portrait mode.

    
    @media (orientation: landscape) {
    
    }
    
    

    In practice, we’ve stopped targeting devices and instead target constraints:

    viewport width is important: tablets are bigger and more conducive to multi-column, side-by-side layouts.

    Some important ideas:

    use breakpoints by EM not PX:

    
    /* instead of */
    @media (min-width: 768px) { /* tablet */ }
    /* use */
    @media (min-width: 45rem) { /* content stops feeling cramped */ }
    
    

    Thanks for that question. I learned some things!

  • No question at this time!

    Great!