CSS Grid Stucture Example

Second Row,


 

First Column

Centered Text.

Second Row


 

Second Column

More Centered Text.

Second Row


 

Third Column

Even More Centered Text.

Third Row


 

Only Column

Text aligned to the left.

CSS


body {
font-family: times new roman; 
font-size: 1em; 
background-color: #D8ECFF;
text-align: left;
}

* {
  box-sizing: border-box;
}

[class*="col-"] {
  float: left;
  padding: 1em;
  border: 0.1em;
  border: 1px solid red;
}

.row::after {
  content: "";
  clear: both;
  display: table;
}

     .col-1 {width: 8.33%}
     .col-2 {width: 16.66%}
     .col-3 {width: 25%}
     .col-4 {width: 33.33%}
     .col-5 {width: 41.66%}
     .col-6 {width: 50%}
     .col-7 {width: 58.33%}
     .col-8 {width: 66.66%}
     .col-9 {width: 8.33%}
     .col-10 {width: 75%}
     .col-11 {width: 83.33%}
     .col-12 {width: 100%}

 a:link {color: #0000CC; text-decoration:none;} 
 a:visited {color: #0000CC; text-decoration:none;}
 a:active {color: #FF3300; text-decoration:none;}
 a:hover {color: #FF0000; text-decoration:none;}

/* for centering things */
.center { 
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}
		 

 

HTML


<!DOCTYPE html> <HTML LANG="en"> <HEAD> <!-- Created in Ken's Korner by Kenneth R. Dubrovin --> <!-- http://kdubrovin.com Copyright May 2019 --> <META Name="viewport" content="width=device-width, initial-scale=1.0"> <META Name="Description" Content="Example of css grid structure! Ken's Korner."> <META Name="Keywords" Content=" Ken's, Korner, Webpages, Ken's Korner, Loveland, Colorado, 80538, Dubrovin"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> <META Name="Author" content="http://kdubrovin.com"> <META Name="Custodian" content="http://kdubrovin.com"> <META Name="Copyright" content="Ken's Korner"> <META Name="Distribution" content="Global"> <META Name="Classification" content="Educational"> <META Name="ABSTRACT" CONTENT="Example page! Web page grid structure with css."> <META Name="Robots" content="all"> <META http-equiv="X-UA-Compatible" content="IE=edge" /> <TITLE>Ken's Korner CSS Grid Stucture Example.</TITLE> <LINK rel="shortcut icon" href="http://kdubrovin.com/favicon.ico" /> <LINK rel="icon" type="image/png" href="http://kdubrovin.com/favicon-32x32.png" sizes="32x32" /> <LINK rel="icon" type="image/png" href="http://kdubrovin.com/favicon-16x16.png" sizes="16x16" /> <LINK REL=STYLESHEET TYPE="text/css" HREF="example.css"> </HEAD> <BODY> <DIV Class="row"> <DIV Class="col-12"> <P><H1 Class="center">CSS Grid Stucture Example</H1></P> </DIV> </DIV> <DIV Class="row" Style="background-color: #FFFFFF;"> <DIV Class="col-4 center"> <H2>Second Row,</H2><BR>&nbsp;<H3>First Column</H3>Centered Text. </DIV> <DIV Class="col-4 center"> <H2>Second Row</H2><BR>&nbsp;<H3>Second Column</H3>More Centered Text. </DIV> <DIV Class="col-4 center"> <H2>Second Row</H2><BR>&nbsp;<H3>Third Column</H3>Even More Centered Text. </DIV> </DIV> <DIV Class="row"> <DIV Class="col-12"> <H2>Third Row</H2><BR>&nbsp;<H3>Only Column</H3> Text aligned to the left. </DIV> </DIV> <DIV Class="row"> </DIV> <DIV Class="col-12" Style="background-color: #FFFFFF;"> <H3>CSS</H3><BR> Example CSS code goes here <BR> &nbsp; </DIV> </DIV> <DIV Class="row"> <DIV Class="col-12" Style="background-color: Yellow;"> <H3>HTML</H3><BR> Example HTML code goes here <BR>&nbsp; </DIV> </DIV> </BODY> </HTML>