S
S
stephenjones2021-03-29 03:25:57
css
stephenjones, 2021-03-29 03:25:57

How to arrange divs in a row and not in a column?

Hello, please tell me how to arrange a div in a row, this code does not work

<!DOCTYPE html>

<body>
  <div id="container">
    <div class="block"></div>
    <div class="block"></div>
    <div class="block"></div>
    <div class="block"></div>
  </div>
</body>
<style>
  #container {
    width: 30vmin;
    height: 30vmin;
    background: green;
                display: inline-block;
  }

  .block {

    width: 10vmin;
    height: 10vmin;
    background: red;
  }
</style>

</html>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Leonid Rozhentsev, 2021-03-29
@RLeo777

You can use flex:

#container {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question