ProgMaster._.

Creating Responsive Grid Page Using HTML & CSS.





This tutorial will guide you through Creating Responsive Grid Page Using HTML & CSS. Follow all the given step :

Step 1 : Create Index.html and add given html code on it.
Step 2 : Create style.css and add given css code on it.
Step 3 : Create index.js and add given JavaScript code on it.

HTML


HTML Code for Responsive Grid Page.



<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Responsive Grid Page</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>

  <h1>Responsive Grid page</h1>
  
  <div class="grid-container">

    <div class="grid-item">
      <img src="https://picsum.photos/200/150?random=1" alt="">
      <h3>Item 1</h3>
      <p>Description About this Post</p>
    </div>

    <div class="grid-item">
      <img src="https://picsum.photos/200/150?random=2" alt="">
      <h3>Item 2</h3>
      <p>Description About this Post</p>
    </div>

    <div class="grid-item">
      <img src="https://picsum.photos/200/150?random=3" alt="">
      <h3>Item 3</h3>
      <p>Description About this Post</p>
    </div>

    <div class="grid-item">
      <img src="https://picsum.photos/200/150?random=4" alt="">
      <h3>Item 4</h3>
      <p>Description About this Post</p>
    </div>

    <div class="grid-item">
      <img src="https://picsum.photos/200/150?random=5" alt="">
      <h3>Item 5</h3>
      <p>Description About this Post</p>
    </div>

    <div class="grid-item">
      <img src="https://picsum.photos/200/150?random=6" alt="">
      <h3>Item 6</h3>
      <p>Description About this Post</p>
    </div>

  </div>

</body>
</html>

    


CSS


CSS Code Responsive Grid Page.

    
body{
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #111;
    color: #fff;
}

h1{
    text-align: center;
    padding: 30px 0;
    font-size: 2rem;
}

.grid-container{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 50px;
}
.grid-item{
    background: #ffffff1f;border-radius: 15px;
    box-shadow: 0 6px 15px #00000080;
    padding: 20px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}
.grid-item:hover{
    transform: translateY(-5px);
    box-shadow: 0 10px 25px #000000b3;
}
.grid-item img{
    max-width: 100%;
    border-radius: 12px;
    margin-bottom: 15px;
}
@media(max-width:600px){
    .grid-container{
        padding: 10px 20px;
        gap: 15px;
    }
}
    


Download Source Code



What is HTML

HTML, or HyperText Markup Language, is the standard markup language used to create and design documents on the World Wide Web. It's essentially the backbone of web pages, providing the structure and content that web browsers interpret and display.

HTML consists of a series of elements, which are enclosed by tags to define their purpose and function on a webpage. These elements can include headings, paragraphs, images, links, lists, forms, and more. By using a combination of HTML elements, web developers can organize and present information in a structured and visually appealing manner.

HTML is not a programming language but rather a markup language. This means it doesn't have the capability to perform calculations or execute complex logic like programming languages do. Instead, HTML focuses on describing the structure and content of a document, leaving the presentation and functionality to other technologies like CSS (Cascading Style Sheets) for styling and JavaScript for interactivity.

In summary, HTML serves as the foundation for building web pages, providing the structure and content necessary for browsers to render and display information to users on the internet.

What is CSS

CSS, or Cascading Style Sheets, is a language used to style the presentation of web documents written in HTML and XML. It provides a way to control the layout, colors, fonts, and other visual aspects of a webpage, enabling developers to create attractive and responsive designs. By separating content from presentation, CSS promotes cleaner code, easier maintenance, and greater flexibility in website design. With CSS, developers can achieve consistent branding, improved user experience, and better accessibility across various devices and screen sizes.

What is JavaScript

JavaScript is a versatile programming language used for creating dynamic and interactive web content. It enables developers to manipulate HTML elements, respond to user actions, and build seamless web applications. With its extensive ecosystem of libraries and frameworks, JavaScript powers both client-side and server-side development, making it an essential tool for modern web development.