We will add HTML structure to some generic content to better understand semantic markup. Then, we will style all the HTML tags with CSS to create a common, but exaggerated page design.
This is a group lab. Please work with a lab partner. One person should be the "typer" for Part 1 and the other person should be the "typer" for Part 1.
Make Chrome your default web browser. We will be using Chrome's code inspector often and you may become frustrated if your inspector is different.
If you have done it already, make sure you display hidden files, folders, and filename extensions
Download the following files to your own lab2
folder, i.e., csis390/labs/lab2
Note that the solutions HTML and CSS are compressed (called minification), which makes it very difficult to copy and use the code. Do not copy the solution and try to reverse-engineering the compression. Your code must be formatted with good spacing and indentation.
Chapter 2 of the zyBook are a great reference for this part. If you do not yet have the book, Mozilla's HTML element reference is also a good source.
page1.txt
in Brackets and immediately save it as page1.html
!DOCTYPE
at the very top so we know its HTMLhtml
to encapsulate or wrap all the text in the file.meta
to use the utf-8 character settitle
so the title is "Website Title"body
to encapsulate or wrap all the content except the title and meta tags.h1
for the main website title "Website Title"h4
for the subheading "Main Menu"ul
and li
to make Page 1, Page 2, ..., Page 5 a bulleted list.a
to make Page 1, Page 2, etc. hyperlinks to page1.html, page2.html, etc.<li><a href="page1.html">Page 1</a></li>
nav
to encapsulate the "Main Menu" and bulleted list as follows:header
to encapsulate the h1
and nav
above.h2
for the main web page header "Web Page Title"main
to encapsulate all the content from the main web page header down to the nested list of the 3rd section.img
to insert an image pica-sm.png
below the web page header.
Be sure to include the alt
attribute to describe the image.a
to make the image a hyperlink to a larger version pica-lg.png
section
to encapsulate or wrap the content of the three different sections.
Note that there are three section titles with content below.
Each section title and the contents below it should be encapsulated with a section
tag.h3
for the three section headings "Section Title"p
for the four example paragraphs in the 1st section and the sentence immediate below the 2nd and 3rd sections.table
, thead
, tbody
, tr
, th
and td
to
properly structure the data in the 2nd section.
See Mozilla's table example for help.ul
, ol
and li
to
properly structure the nested list in the 3rd section. See zyBook 2.4 for help with properly nesting lists.footer
to encapsulate the bottom-most footer content.Your web page's body
(the visible content) should have the following tree-like structure when complete:
Note that the body
contains header
, main
and footer
.
And, main
contains h2
, a
and three sections
.
Chapter 3 of the zyBook are a great reference for this part. If you do not yet have the book, Mozilla's CSS reference is also a good source.
page1.html
in Brackets and add a link to a CSS file by adding
the following line of code directly above the title
tag:
<link rel="stylesheet" type="text/css" href="style.css">
link
tag you just added
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,700" rel="stylesheet">
style.css
in your lab2
folder.style.css
and then you will save the file and reload page1.html
in Chrome by pressing the reload button to see the change.style.css
, reload page1.html
to see change, and then read the
notes to better understand the changes:body
of the page:
body { font-family: 'Roboto', sans-serif; background: linear-gradient(to bottom, #ddddee, #333344); margin: 0px; padding: 0px; }Notes:
body
tag.header
of the page:
header { box-sizing: border-box; width: 100%; position: fixed; top: 0px; background-color: #333399; color: white; margin: 0px; padding: 10px 20px; }Notes:
header
tag to create a typical website header.box-sizing
and width: 100%
makes the header as wide as possible taking up the entire width of the browser window.position: fixed
and top: 0
makes the header stick to the top.nav
of the page:
nav ul { list-style: none; padding: 0px; margin: 0px; } nav li { float: left; margin: 0px; padding: 0px; } nav li a { display: inline-block; border: 1px solid #aaaaee; padding: 10px 20px; margin: 0px 5px; color: #bbbbff; background-color: #333366; text-decoration: none; } nav li a:hover { background-color: #3333dd; color: white; } nav h4 { display: none; }Notes:
nav
area.h1
and nav
of the header:
header h1 { float: left; font-weight: 100; margin: 0px; padding: 0px; } header nav { float: right; }Notes:
main
to make it look like a fixed-width page:
main { width: 600px; margin: 150px auto 0px; padding: 20px; background-color: white; color: #444; box-shadow: 5px 5px 10px #444; border-radius: 20px; font-size: 1.1em; }Notes:
h2
in the main area:
main h2 { font-size: 1.8em; font-weight: 300; color: #000000; text-align: center; margin: -20px -20px 0px; padding: 5px 0; background: linear-gradient(to top, #ddaa00, #ffff00); border-top-right-radius: 15px; border-top-left-radius: 15px; }Notes:
img
in the main area:
main img { position: absolute; top: 60px; left: 10px; z-index: -1; }Notes:
table
in the main area:
main table { border-collapse: collapse; } main td, main th { border: 1px solid black; padding: 5px 10px } main th { background-color: #ff4422; color: white; } main tr:nth-child(even) { background-color: #ffff00; }Notes:
border-collapse
is necessary otherwise adjacent cells (td
and th
) will have a double bordernth-child
allows us to only change the even table rowsmain ul { list-style: square; } main ol { list-style: lower-roman; }Notes:
p
in the main area
main p { text-indent: 20px; text-align: justify; }
footer
footer { text-align: center; color: #ccccff; padding: 20px 0 40px; }
Modify the h3
in the main area and make it look very unique by adding at least 4 CSS properties. Play around with
various CSS properties that you learned about in the previous part.
style.css
)
validates at: jigsaw.w3.org/css-validator
Submit, your page1.html
and style.css
file in Canvas.
In the comment area of Canvas put your partner's name if applicable.
The deliverable must be submitted in Canvas by midnight on the Monday before your next scheduled lab meeting. If you wish to work alone, you can submit the deliverable yourself. When submitting as a lab pair, be sure to include your partner's name in the comment area when you submit via Canvas.
Outside of lab, you are only permitted to work with your lab partner. Do not share your work with any other student.