Ask any question about HTML here... and get an instant response.
How can I create a flexible layout that adjusts to different screen sizes using HTML?
Asked on Dec 09, 2025
Answer
To create a flexible layout that adjusts to different screen sizes, you can use responsive design techniques such as CSS Flexbox or Grid. These methods allow you to create layouts that automatically adjust to the size of the screen.
<!-- BEGIN COPY / PASTE -->
<div style="display: flex; flex-wrap: wrap;">
<div style="flex: 1 1 200px; padding: 10px; box-sizing: border-box;">
<p>Content Block 1</p>
</div>
<div style="flex: 1 1 200px; padding: 10px; box-sizing: border-box;">
<p>Content Block 2</p>
</div>
<div style="flex: 1 1 200px; padding: 10px; box-sizing: border-box;">
<p>Content Block 3</p>
</div>
</div>
<!-- END COPY / PASTE -->Additional Comment:
- The
flexproperty in<div>elements allows them to grow and shrink based on the available space. flex-wrap: wrap;ensures that items move to the next line if they don't fit in one row.- Using
box-sizing: border-box;includes padding and border in the element's total width and height.
✅ Answered with HTML best practices.
Recommended Links:
