Grid includes an intuitive "ASCII art" syntax where you can virtually "see" the layout within your code, so this makes it extremely easy to create and modify to your layout. Even major changes can be done within a few seconds. This intuitive syntax also helps with responsive web design. Creating different layouts for different devices becomes quite trivial when using grid.
HTML
Before we start writing code first, we need to create a primary structure of the HTML document, so that the browser can understand and start working. The basic HTML structure looks like the following.
After writing the primary structure of the HTML document, you will also write the tags and content you need. After that, you can see the output in your browser. We know that HTML Sudu Mae is used for exposing content in a basic format. To complete our content we need to use CSS, which is an HTML insert and it creates an engaging user interface.
<!DOCTYPE html>
<html>
<head>
<title>GRID</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="wrapper">
<div class="manubar">manubar</div>
<div class="main-content">main content</div>
<div class="sideber">sideber</div>
<div class="box1">box1</div>
<div class="box2">box2</div>
<div class="box3">box1</div>
<div class="fotter">fotter</div>
</div>
</body>
</html>
CSS
Now, we have time to improve the HTML content, for that, we need to add CSS to the HTML file. CSS can be added to HTML documents in a total of three ways, here we are using outside CSS design using CSS will arrive here after typing and see the output in your browser.*{
box-sizing: border-box;
padding-top: 20px;
}
body{
background:#96a8c0;
}
.wrapper{
max-width: 900px;
margin: 0 auto;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: minmax(100px, auto);
grid-gap: 10px;
}
.wrapper >div{
border:2px solid red;
border-radius: 5px;
background:#ffffff;
padding: 10px;
font-size: 2em;
}
.manuba{
grid-column: 1/3;
grid-row: 1;
}
.main-content{
grid-column: 2/4;
grid-row: 1/3;
}
.sideber{
grid-column: 1;
grid-row: 2/5;
}
.box1{
grid-column:2/4;
grid-row: 3;
}
.box2{
grid-column:2;
grid-row: 4;
}
.box3{
grid-column:3;
grid-row: 4;
}
.fotter{
grid-column: 1/4;
grid-row: 5;
}
No comments: