Horje

How to create Grid Mobile and Desktop Ways

Try it.
index.html
Example: HTML
<style>
body {
  font-family: Arial, sans-serif;
  font-size: 20px;
  padding: 0 20px;
}

main {
  text-align: center;
  margin: 0 auto;
  max-width: 800px;
}

p {
  text-align: left;
  padding: 0 20px;
}

.container {
  display: grid;
  gap: .5em;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
}

.item {
  width: 100px;
  min-height: 100px;
  background: lightblue;
  border: solid 1px;
  border-radius: 6px;
}    
</style>






<main>
  <h2>Responsive Grid with No Media Queries</h2>
  
  <p>Resize the window to allow the grid items to break onto new lines. Notice the grid is fully responsive, with no need for any media queries.</p>

  <div class="container">
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
  </div>

</main>

Output should be:

How to create Grid Mobile and Desktop Ways



Single Articles
How to create Grid Mobile and Desktop WaysHTML Responsive Grid Tutorial


Related Articles
How to create Full HTML Responsive with Desktop and Mobile HTML Responsive Grid Tutorial
How to add Responsive Grid with Awesome Font HTML Responsive Grid Tutorial

Type:
Html
Category:
Web Tutorial
Sub Category:
HTML Responsive Grid Tutorial
Uploaded by:
Admin



Share on: