CSS CSS Flexbox Layout Flexbox Properties Smarter Layouts with flex-basis and flex

Benjamin Masterman
Benjamin Masterman
14,915 Points

Is it normal for the device toolbar in Chrome developer tools to deactivate the flexbox wrap property?

When I display my code in the browser, my items wrap. When I display my code in the chrome developer tool my items will not wrap with the device toolbar engaged. If I deactivate the device toolbar the flexbox returns to normal operation. Is this normal and to be expected?

1 Answer

Steven Parker
Steven Parker
204,842 Points

Are you perhaps changing the window size when you activate the toolbar and enabling (or disabling) a media query that causes the change?

If that's not it, make a snapshot of your workspace and post the link to it here.

Benjamin Masterman
Benjamin Masterman
14,915 Points

I don't have any media queries in the code. I wish I was better versed in posting here but try this out. I can't get item 4 to wrap to the bottom while the Chrome Developer tools' device toolbar is engaged.

index.html///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<!DOCTYPE html>
<html>
<head>
    <title>Flexbox Layout</title>
    <link href='https://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="css/page.css">
    <link rel="stylesheet" href="css/flexbox.css">
</head>
<body>
    <div class="container">
        <div class="item-1 item">
            Item 1
            <p>Mustache cred 3 wolf moon shabby chic, flannel vegan Godard selfies aesthetic taxidermy post-ironic forage deep v tousled.</p>
        </div>
        <div class="item-2 item">
            Item 2
            <p>Vegan meggings hashtag, before they sold out Pitchfork next level vinyl. Fanny pack direct trade High Life.</p>
            <p>Bicycle rights mumblecore irony disrupt.</p>
        </div>
        <div class="item-3 item">
            Item 3
            <p>Banksy squid distillery Portland whatever, lo-fi Wes Anderson.</p>
        </div>
        <div class="item-4 item">
            Item 4
            <p>Sriracha raw denim fixie.</p>
        </div>
    </div>
</body>
</html>
flexbox.css/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* ================================= 
  Flexbox
==================================== */

.container {
    display: flex;
    flex-wrap: wrap;
  height: 450px;
}

.item {
  flex: 1;
}

.item-1 {
  align-self: flex-end;
}

.item-2 {
  flex: 2;
}

.item-4 {
  align-self:center;
}
```page.css/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* ================================= 
  Page Styles
==================================== */

* {
    box-sizing: border-box;
}
body {
    font-size: 1.35em;
    font-family: 'Varela Round', sans-serif;
    color: #fff;
    background: #e8e9e9;
    padding-left: 5%;
    padding-right: 5%;
}
p {
    font-size: 15px;
    line-height: 1.5;
}
.container {
    margin: 45px auto;
    padding: 10px;
    background: #fff;
  border-radius: 5px;
  box-shadow: 0 1.5px 0 0 rgba(0,0,0,0.1);
}
.item {
    color: #fff;
    padding: 15px;
    margin: 5px;    
    background: #3db5da;
    border-radius: 3px;
}