Lab 1
HTML & CSS Introduction
Lab Setup
Create lab folders
- Create a folder in your user drive (Z:) for storing your course work called
csis390/
.
- Create a sub-folder in your
csis390
folder for storing your lab work, i.e.,
csis390/labs
.
- Create sub-folders for all the labs, i.e.,
lab1, lab2, ..., lab3
.
Make sure you can view file extensions in Windows
- Click the Start menu
- Type "folder options" in the search and click "Folder Options" when it appears at the top of the Start menu
- A dialog box with the title "Folder Options" will appear. Click the "View" tab at the top of the window
- Click to uncheck the box for "Hide extensions for known file types"
- Click the "OK" button at the bottom of the dialog box
Download Starter Files
Download all the images (.png) and text files (.txt) from this
lab1 folder
to your own lab1
folder, i.e., csis390/labs/lab1
1. Creating HTML Documents
- Open
starter.txt
in Notepad++ and immediately save it as
starter.html
.
- Add you and your partner's name at the top using an HTML comment.
- Use HTML markup to make the web page look like
starter.pdf
-
Be sure to appropriately add the following HTML tags.
Chapter 1 of the zyBook will explain how to appropriately use
these tags.
!DOCTYPE
so we know its HTML
html
to encapsulate all the data
meta
to use the utf-8 character set
title
so the title is "My Little Pony: Applejack"
body
to encapsulate all the visible content
h1
for the main top title "Applejack"
h2
for all the sub-headings
p
for all the paragraphs
h3
for the sub-headings in the Skills sub-section
em
for all the instances of the phrase "My Little Pony"
u
for all the instances of the word "Friendship"
strong
for all the instances of the word "Applejack"
Hint
: use find and replace as there are many instances
ul
and li
to make a bulleted list for the 4 episodes in the "Strength"
sub-section inside the "Skills" sub-section
img
to add the small and larger image. Use
the width
attribute to reduce the size of the larger image.
TASK CHECK
Verify that the document validates at:
html5.validator.nu
Then, show your instructor your completed valid document.
2. Styling Documents with CSS
- Immediately save
starter.html
as final.html
.
- Add a
style
tag to final.html
for storing embedded CSS code.
- Add CSS selectors and properties to make the web page look like this:
final.pdf
-
Chapter 1 of the zyBook will explain CSS syntax, selectors and properties.
- Use the following directions to help you match the style.
Your web page does not have to exactly match but it needs to be a close approximation.
- Structural Additions
-
Put all the visible content inside a
div
tag, i.e.,
<body>
<div>
All the visible content
</div>
</body>
We will use this div
tag
to create the "page" look and feel.
-
Put all the "Skills" content inside a
section
tag so we can
indent and add style to this section to emphasize that is a sub-section.
-
Give the small image an
id
and the value "image-small"
so we can uniquely identify it:
<img src="image-small.png" alt="Applejack" id="image-small">
-
Give the larger image an
id
and the value "image-larger"
so we can uniquely identify it.
- body
- use a dark gray background color
- line-height of 1.5rem
- div
- white or very light background color
- width of 400px
- use auto margins to center the "page"
- padding of 30px
- border-radius of 10px
- position: relative
- h1
- font-size of 4rem
- line-height of 4rem
- border that is 2px solid; pick a nice color
- padding of 15px all around
- border-radius of 5px
- bottom-margin of 20px; all other margins should be 0px
- text-align center
- pick a nice background-color
- pick a nice color for the text
- h2
- font-size of 2rem
- font-weight should be normal instead of the default bold
- border-bottom that is 1px solid gray
- h3
- text-transform to uppercase
- font-size of 1.1rem
- margin-bottom of 0px so it is closer to the paragraphs
- p
- text-align should be justify
- margin of 0.5rem on top, margin of 0px on the other three sides
- strong
- color of text should be orange
- em
- font-family should be cursive
- font-size of 1.2rem
- color should be pink or purple
- u
- remove the underline using text-decoration
- 1px solid black border
- add some padding so the border is not too close to the text
- border-radius of 5px
- light yellow background-color
- section
- font-size of 0.8rem
- border-left of 30px that is solid and gray
- padding-left of about 15px
- li
- list-style should be square instead of round bullets
- #image-small
- position: absolute
- top: 0px
- left: 60px
- height: 140px
- #image-larger
- position: absolute and try to figure out the top, right and height values
to position it to match the final design.
Bonus
Read in Chapter 2 about background gradients and then add a linear-gradient to the background of the h1 tag.
TASK CHECK
Show your instructor your completed document and that it validates here:
html5.validator.nu
3. HTML Tables & Lists
-
Open
data.txt
in Notepad++
and immediately save it asdata.html
.
- Add you and your partner's name at the top using an HTML comment.
-
Use HTML markup to make the web page look like this data_structured.pdf web page.
-
Hints:
-
Use the
table
, thead
, tbody
, tr
,
td
, and th
tags to properly structure the table.
-
Here are examples of how these tags are used.
-
Use the
ul
and li
tags to properly structure a nested list.
-
Read about the
proper way to make HTML nested lists.
-
Be sure your code validates at
html5.validator.nu
-
Use CSS to make the web page look like
data_styled.pdf
- Hints:
-
Give both the
td
and th
tags a solid black border and padding
so the table looks more like a table.
-
Use the
border-collapse
property so the border look like normal table borders.
-
Read about the
border-collapse property to learn more.
-
Give the
th
tag a dark background color and white text
-
Read about the
nth-child()
selector to give the even rows a different background color.
-
Use the
nth-child()
selector to center the 3rd and 4th columns of data and
to right justify the first column.
-
Give the
ul
padding of zero.
-
Give the
li
a list-style
of none and
display using inline-block
.
-
Read about the difference between
inline, block and inline-block display.
-
Experiment with the padding, margin, font-size
and background-color to match the look of the outer list items
-
Use the selector
ul ul li
, to give the innerli
tags
a different look.
-
Read Chapter 2.6 in the zyBook to learn more about advanced selectors.
- Experiment with the padding, margin, font-size, color and
background-color to match the style approximately.
DELIVERABLE
Submit, your final.html
and data.html
file in Blackboard.
In the comment area of Blackboard put your partner's name.
Not finished?
The deliverable must be submitted in Blackboard by midnight on the day before your
next scheduled lab meeting. If you wish to work alone, you can submit the deliverable
yourself. However, you are encouraged to work with your partner and you can
submit together. When submitting as a lab pair,
be sure to include your partner's name in the comment area
when you submit via Blackboard.
Do not share
Outside of lab, you are only permitted to work with your lab partner. Do not share your
work with any other student.