Grid includes an automatic "easy coding" art" arrangement where you can virtually "see" the layout within your code, so this makes it extremely easy to build and modify your layout. Even major modifications can be done within a few seconds. This intuitive syntax also helps with understanding web layout. Performing different layouts for different devices displays quite trivial when using grid
CSS Grid is a new, hot trend in web development these days. Forget about table layouts and floats: a new way to design websites is now here! This technology presents two-dimensional grids that define multiple areas of a layout with a few CSS rules.
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>
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: