Web Development

Dr Derek Bridge
School of Computer Science & Information Technology
University College Cork

Lecture Objectives

  • learn a little about grid layout from examples

CSS Grid Layout

Grid Layout makes two-dimensional layouts easy (easier).

A grid contains items arranged in columns and rows

A Complete Guide to Grid Layout

Grid for an Image Gallery

Another Grid Example

Grid for a Two-column Layout

Grid for a Two-column Layout


body {
    display: grid;
    grid-template-columns: 1fr 3fr;
    grid-template-areas: "top top"
                         "middle-left middle-right"
                         "bottom bottom"
}
    
header {
    grid-area: top;
}
    
nav {
    grid-area: middle-left;
}
    
main {
    grid-area: middle-right;
}
    
footer {
    grid-area: bottom;
}
    

G'luck!