New Lab 14
Goal
- Learn and gain understand of display grid.
Learn
body{
display:grid;
}
display:grid;
Defines the element as a grid container and establishes a new grid formatting context for its contents. Display Grid is a layout system available in CSS. Unlike Display Flex which only allows control for either rows or columns, Display Grid allows the user to control both rows and columns.
body{
display:grid;
grid-template-columns: 40px 15% auto 10rem;
grid-template-rows:25% 100px auto;
}
grid-template-rows
Defines the rows of the grid with a space-separated list of values. The values represent the track size, and the space between them represents the grid line.
grid-template-columns
Defines the columns of the grid with a space-separated list of values. The values represent the track size, and the space between them represents the grid line.
Values: can be a length, a percentage, or a fraction of the free space in the grid (using the fr unit).
Below is a representation of the display grid properties and values from the code above. The white outline is the edge of the <body> and the white vertical and horizontal lines represent the start and end of each column or row. The green values shown along the bottom and right are the numbers assigned to each horizontal and vertical line that create the grid. These numbers can be referenced with grid-item properties to move and stretch the elements within different cells in the grid.

gap
body{
display:grid;
grid-template-columns: 40px 15% auto 10rem;
grid-template-rows:25% 100px auto;
gap: 1rem;
}
Defines the gaps (gutters) between rows and columns.
Grid-Item Properties
By default any elements that are direct descendants of the grid container will be assigned a grid cell. The will be ordered from left to right, wrapping to a new row as needed. The placement of individual elements can be changed with the following properties:
.item1{
grid-column-start:1;
grid-column-end:4;
grid-row-start:1;
grid-row-end:3;
}
Hint: When using the grid-item properties to move elements around there is not a unit assigned.
The properties above define a grid item's location within the grid by referring to specific grid lines (the green numbers in the image above). So if the <body> had a four <div> each with a class such as item-1, item-2, etc... We could use grid-row-start, grid-column-start, grid-row-end, and grid-column-end to move the elements into grid cells they were initially assigned to or multiple cells. Like below:

.item4{
grid-column:1/4;
grid-row:3/4;
}
The code above is a shorter version of the grid-item properties above. When using grid-row and grid-column the grid line values are separated by a slash. The values also go in this order: start/end.

.item-2{
grid-area: 1/4/3/5;
}
The code above is the shortest version of the grid-items properties. The values for grid-area are: row-start/column-start/row-end/column-end.

Practice
Experiment Try moving the items around the grid using the image above as a guide. Use grid-area, grid-column, grid-row, grid-row-start, grid-column-start, grid-row-end, or grid-column-end to move the items.
HTML
CSS
Preview
Complete Grid Garden
With your cs-318 repository selected, Click open in Visual Studio code.
Create a new folder called lab14
Create a new files called index.html, ankh-morpork.html, characters.html, author.html, and books.html in the lab14 folder
Setup your HTML files
Create your stylesheet
Link your stylesheet to the HTML
Change Document in the <title> element to "Discworld"
Index.html
Add a header, main, and footer
In the header add
- h1 - Discworld
- nav
- a - Characters - characters.html
- a - Ankh Morkpork - ankh-morkpork.html
- a - Books - books.html
- a - Pratchett - author.html
In the footer add two divs
In the first div add the same links as the nav plus one for the home page.

In the second div add a p with the following text : Postal Address:Discworld Emporium, Guild House, Station Road, Wincanton, Somerset BA9 9FE Call us: 07940 286605 Email: shop@discworldemporium.com
Use the break tag to separate the lines of text within the paragraph
Add anchors around the phone number and email. Use mailto: and tel: in the href to setup the link.

We are going to use the hover pseudo class to make a dropdown in the navigation. To do this the HTML must be set up so there is a container around the link with the dropdown box inside as well. That way the are grouped together.
Around the link for characters add a div with the class "dropdown"
Inside the div after the anchor add another div. Inside this div we will add all of our jump links for the characters page.
Add the following anchors for the jump links
- characters.html#sam-vimes - Samuel Vimes
- characters.html#carrot - Carrot Ironfoundersson
- characters.html#angua - Angua von Überwald
- characters.html#nobby - Nobby Nobs
- characters.html#colon - Fred Colon
- characters.html#ridcully - Mustrum Ridcully
- characters.html#rincewind - Rincewind
- characters.html#librarian - The Librarian
- characters.html#death - Death
- characters.html#vetinari - Lord Vetinari
- characters.html#dibbler - CMOT Dibbler
- characters.html#moist - Moist von Lipwig
- characters.html#granny - Granny Weatherwax
- characters.html#nanny - Nanny Ogg
- characters.html#luggage - The Luggage
Around the link for books add a div with the class "dropdown"
Inside the div after the anchor add another div. Inside this div we will add all of our jump links for the books page.
Add the following anchors for the jump links
- books.html#the-color-of-magic - The Colour of Magic
- books.html#the-light-fantastic - The Light Fantastic
- books.html#equal-rites - Equal Rites
- books.html#mort - Mort
- books.html#sourcery - Sourcery
- books.html#wyrd-sisters - Wyrd Sisters
- books.html#pyramids - Pyramids
- books.html#guards-guards - Guards! Guards!
- books.html#eric - Faust Eric
- books.html#moving-pictures - Moving Pictures
- books.html#reaper-man - Reaper Man
- books.html#withches-abroad - Witches Abroad
- books.html#small-gods - Small Gods
- books.html#lords-and-ladies - Lords and Ladies
- books.html#men-at-arms - Men at Arms
- books.html#soul-music - Soul Music
- books.html#interesting-times - Interesting Times
- books.html#maskarade - Maskerade
- books.html#feet-of-clay - Feet of Clay
- books.html#hogfather - Hogfather
- books.html#jingo - Jingo
- books.html#the-last-continent - The Last Continent
- books.html#carpe-jugulum - Carpe Jugulum
- books.html#the-fifth-elephant - The Fifth Elephant
- books.html#the-truth - The Truth
- books.html#the-thief-of-time - Thief of Time
- books.html#the-last-hero - The Last Hero
- books.html#night-watch - Night Watch
- books.html#the-wee-free-men - The Wee Free Men
- books.html#monstrous-regiment - Monstrous Regiment
- books.html#a-hat-full-of-sky - A Hat Full of Sky
- books.html#going-postal - Going Postal
- books.html#thud - Thud!
- books.html#wintersmith - Wintersmith
- books.html#making-money - Making Money
- books.html#unseen-academicals - Unseen Academicals
- books.html#i-shall-wear-midnight - I Shall Wear Midnight
- books.html#snuff - Snuff
- books.html#raising-steam - Raising Steam
- books.html#the-shepards-crown - The Shepherd's Crown
In the links find "Faust" add a <s> tag around the word. This will create a strike through.

Copy everything on the index file and paste it on to all the other html files.
Index.html
In the main add two sections
Section1
Add a class of hero
In the section add
- h2 - Welcome to Discworld
- img - The Great Atuin
Section 2
Add class of home-about
Add two divs
div 1
- Img - Discworld map
- div class of actions
- a - characters.html - Meet the Characters
- a - ankh-morkpork.html - Vist Ankh Morkpork
- a - books.html - Read the books
div 2 add the following paragraphs
- Once upon a time, there was a multi-million selling author called Sir Terry Pratchett…
- Born in 1948 in Beaconsfield Buckinghamshire, Terry began his writing career at the library. He wrote his first book, The Carpet People, aged just 17 and as a journalist for the Bucks Free Press and Bath & West Evening Chronicle, wrote copious newspaper columns and short stories. While Press Officer for the Central Electrical Generating Board at Hinkley Point in North Somerset, Terry wrote Strata, Dark Side of the Sun and began his first forays into Discworld…
- The Colour of Magic was published in 1983 and so began a prolific literary phenomenon. Discworld spans an incredible 41 books while there are over 40 companion volumes and non-Discworld titles to enjoy.
- With its beginnings in fantasy satire, the Discworld series evolves to explore themes of the human condition, tackling issues of race, mortality, gender, religion, class and conflict, punctuated with Pratchett’s exceptional wit, and garnished with the magic of fantasy.
- Discworld is one of richest landscapes in literature, with a cast of literally thousands of characters. Terry’s main protagonists such as Granny Weatherwax and Nanny Ogg, Death, Sam Vimes and the City Watch, not to mention Rincewind and the Wizards of Unseen University enjoy multiple appearances throughout the series, and books can be read in any order, although there is certainly joy to be had in reading each book as it was published!
- Renowned as a mirror to our own world, Discworld will take you on adventures that will have you laughing out loud one minute, and solemnly contemplating the trials of life the next. As profound as it is funny, Discworld also brims with references from Terry’s encyclopaedic mind that will often require many re-reads to recognise. Discworld is an addictive tapestry of hilarious and heartfelt narrative and characters that you will want to visit again and again!
- In our three decades experience of creating Discworld souvenirs and meeting fans from all around the world, we can distinguish no clear favourites in the Discworld canon. There is a Discworld book for everybody, and a particular book can be beloved for all manner of personal reasons. Profound but not preachy, gritty but never too graphic, Terry’s books bring comfort and escapism to a wide audience from all walks of life. For the uninitiated, a first step on Discworld can seem somewhat daunting, but we can only recommend taking the plunge and getting swept up in the wonderful world of Terry Pratchett!
- Terry became Britain’s bestselling author of the 1990’s and remains one of the most prolific and distinguished authors of all time, selling over 85 million books worldwide in 37 languages. He was awarded ten honorary doctorates, appointed Officer of the Order of the British Empire in 1998 and knighted for ‘Services to Literature’ in 2010. A champion of social Justice in life and on the page, Terry was also an avid advocate for wildlife conservation and a voice for those living with Alzheimer’s and memory diseases through his documentaries, interviews, and charitable work. He completed his final novel and the last book in the Discworld canon, The Shepherd’s Crown, in 2014.
- After a long battle with Post Cortical Atrophy, Terry succumbed to the ’Embuggerance’, taking a walk with Death on March 12th 2015 aged 66. He lives on in the books on our shelves, and in our wonderful memories of the precious times that he shared with us.

Characters.html
On the main add class characters
In the main add four sections
Section 1
Add a hgroup tag. In the hgroup tag add
- h2 - Discworld Characters
- img - Discworld Characters
Hint: There will be many images it may behoove you to have subfolders inside the images folder for each page.

Section 2
Add hgroup
- h2 - The City Watch
- p - The Ankh-Morpork Watch & Ward was founded in AM 1561 by King Veltrick I. They had full copper armour and a copper shield inscribed "Fabricati Diem, Pvncti Agvnt Celeriter" ("Make the Day, the Moments Pass Quickly", Veltrick's motto). Four days later Veltrick's son assassinated him, and became Veltrick II. Since he had little interest in maintaining a police force the smart armour and equipment of the Watch quickly deteriorated.
Add five <figure> tags. Inside each one add a image tag and a <figcaption> tag.
- img - Sam Vimes
- figcaption - Samuel Vimes
- img - Carrot
- figcaption - Carrot Ironfoundersson
- img - Angua
- figcaption - Angua von Überwald
- img - Nobby
- figcaption - Corporal C,. W. St J. (Cecil Wormsborough St John) generally known as Nobby
- img - Colon
- figcaption - Frederick Colon, Sergeant

Section 3
add hgroup
- h2 - The Wizards and Staff of the Unseen University
- p - Unseen University is a school of wizardry in Discworld's city of Ankh-Morpork, staffed by a faculty composed of mostly indolent and inept old wizards. The official motto of UU is "Nunc Id Vides, Nunc Ne Vides", loosely translated as "Now you see it, now you don't". The unofficial motto is "Eta Beta Pi" (Eat A Better Pie). The university's name is a pun on the real-world Invisible College.
Add four <figure> with a image tag and <figcaption> tag inside each.
- img - Ridcully
- figcaption - Mustrum Ridcully Archchancellor
- img - Rincewind
- figcaption - Rincewind
- img - Faculty
- figcaption - The Rest of the Wizards
- img - Librarian
- figcaption - The Librarian
Section 4
hgroup
- h2 - Other Notable Characters
Add seven <figure> with a image tag and <figcaption> tag inside each.
- img - Death
- figcaption - Death, The Defeater of Empires, the swallower of Oceans, the Thief of Years, the Ultimate Reality, the Harvester of Mankind, the Assassin against Whom No Lock Will Hold, the only friend of the poor and the best doctor for the mortally wounded. An anthropomorphic personification. Almost the oldest creature in the universe (obviously something had to die first).
- img - Vetinari
- figcaption - Lord Havelock Vetinari, The Patrician and supreme ruler of the city of Ankh-Morpork
- img - Dibbler
- figcaption - CMOT Dibbler
- img - Lipwig
- figcaption - Moist von Lipwig
- img - Weatherwax
- figcaption - Esmerelda Weatherwax, Granny Weatherwax
- img - Ogg
- figcaption - Nanny Ogg
- img - Luggage
- figcaption - The Luggage