0

I'm trying to learn Flexbox but there is a problem. Now, I'm working on flex-shrink and I noticed that my items inside of the container don't shrink their size unless width of the container is 200px(or more).

Here's my code:

.container {
    width: 800px;
    height: 450px;
    border: 2px solid green;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
}

.item {
    width: 90px;
    background-color: #ddd;
    margin: 10px; 
    padding: 10px 15px;
    text-align: center;
    font-family: Arial;
}

.item:nth-child(4) {
    flex-shrink: 3;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My Docunent</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <div class="container">
        <div class="item">text1</div>
        <div class="item">text2</div>
        <div class="item">text3</div>
        <div class="item">text4</div>
    </div>
</body>
</html>
GucciBananaKing99
  • 1,473
  • 1
  • 11
  • 31
Lshiroc
  • 39
  • 2
  • 7

0 Answers0