poner los div uno debajo de otro cuando reduzca el tamaño de la pantalla con css y html in javascript

To achieve this, you can use CSS Flexbox which makes it easy to arrange elements in a row or column. Here's an example code:

HTML:

index.tsx
<body>
    <div class="container">
        <div class="box">Box 1</div>
        <div class="box">Box 2</div>
        <div class="box">Box 3</div>
    </div>
</body>
165 chars
8 lines

CSS:

index.tsx
.container {
  display: flex;
  flex-direction: column;
}

.box {
  height: 100px;
  background-color: blue;
  margin-bottom: 10px;
}
134 chars
11 lines

In this code, the container has a flex-direction of column which allows the boxes to stack vertically. If you want the boxes to stack horizontally, you can change the flex-direction to row.

The margin-bottom property is used to create a gap between the boxes. You can adjust the value of this property to fit your requirements.

With this code, when the screen size is reduced, the boxes will stack vertically instead of horizontally.

related categories

gistlibby LogSnag