Lab 6: CSS: Text, Colors, & Backgrounds
Goals
Learn about...
- How to apply CSS to HTML documents
- About font and text-related CSS properties
- How colors are defined and applied
- Applying background images and patterns
Key Concept
Cascading Style Sheets (CSS) can be used define almost every aspect of an HTML document's visual presentation. The beauty of CSS is that all the pages of a logical website can share the same stylesheet, which allows a designer to change the appearance of many web pages by changing the code in one file.
Pre-lab
Pre-lab Reading
- Textbook pp 207-222
Pre-lab Activity
- Textbook exercise 11-1
- Textbook exercise 11-2
Use reading and activity to answer the Pre-lab Questions. Be sure to complete the activity and answer the pre-lab questions in Blackboard before the start of the lab period.
In-lab
Info
Working with others
You should not collaborate with anyone outside of the designated two-hour lab session.
Preparation
- Always make sure you save your lab file in the appropriate folder, i.e., lab6.
- For file names, only use lowercase letter and never use spaces.
Activity
You can work together with a partner during lab. But you must complete this part of the lab on your own. You should not collaborate with your partner outside of the designated two-hour lab session.
Formatting Menus
- Download menu.html and save it to your lab6 folder.
- Use the menu.htmlfile and complete exercise 12-1 through 12-7 using Notepad++. Refer to pages 225-258 for help.
- It is OK to peek at the solution if you get lost, but do not look at it until you try to do all parts of the activity.
- Make sure menu.html validates at http://validator.w3.org/#validate_by_upload
- Show your instructor that menu.html is finished and validates.
Font & Text Questions
- In Notepad++, create a webpage called lab6.html
- Remember to include the basic HTML document structure shown on page 56 (Figure 4-7).
- Answer the following questions and use HTML and CSS to appropriately markup and style your answers according to the instructions in the questions below. Use the HTML
span
tag withclass="answer"
to markup your answers below. The style will be the same for all four questions. Font & Text:
- What is the name of the CSS property for changing the font type. Use embedded CSS so that
.answer
uses the Georgia font. - What is the name of the CSS property to make the font italic. Use embedded CSS so that
.answer
will be italic. - What is the name of the CSS property to change the text color. Use embedded CSS so that
.answer
will have red text. - What is the name of the CSS property to make text bold. Use embedded CSS so that
.answer
will have bold text.
- What is the name of the CSS property for changing the font type. Use embedded CSS so that
- In the end, the answers in your final document should look like this: answer.
- Save your lab6.html file. We will answer more questions at the end of the lab.
Adding Color
- Download bistro.html and save it to your lab6 folder.
- In your lab6 folder, create a sub-folder called images.
- Download the following pictures into the images folder you just created:
- Use the bistro.htmlfile and complete exercise 13-1 through 13-7 using Notepad++. Refer to pages 265-295 for help.
- It is OK to peek at the solution if you get lost, but do not look at it until you try to do all parts of the activity.
- Make sure bistro.html validates at http://validator.w3.org/#validate_by_upload
- Show your instructor that bistro.html is finished and validates.
Color & Background Questions
- Continue to answer the following questions in yourlab6.htmlfile.
Color & Background:
- What is the HTML color code (#hexcode) for yellow? Use the HTML
span
tag withclass="answer"
to markup your answer below. Then use embedded CSS so that.answer
will have a background color of yellow. - What is the CSS property for specifying a background image. You do not have to use this property, just name it.
- What is the CSS code to position a background image so that it does not repeat and is centered horizontally at the top. You do not have to use this property, just write the code.
- What is the HTML color code (#hexcode) for yellow? Use the HTML
- In the end, the answers in your final document should look like this: answer.
- Save your lab6.html file.
Deliverables
Upload lab6.html to Blackboard.