Self study
Lesson 4, Fundamentals of HTML, XHMTL, and CSS 75
Self study
1 In this lesson, you discovered three categories of styles: internal, external and inline. You
also created an element style, and a class style and then move them into an external style
sheet. Additionally, you explored how to link an external style sheet to a new HTML page.
Review
Questions
1 What is a doctype and how does it relate to page validation?
2 In the following XHTML code what is the attribute and what is the attribute value?
What other attributes would you often fi nd in an img element such as this?
<img src="images/blueberry_smoothie.jpg"/>
3 Defi ne the purpose of an external style sheet and one of the benefi ts of using an external
style sheet.
Answers
1 A doctype is a declaration at the start of your HTML document. It is used by a web
browser to determine what markup language and version is used on the page. Page
validation tests the syntax of your code against the specifi cations of your doctype.
Page validation is a good way to check your page for problems such as missing tags or
typographical errors in your code.
2 In this line of code src is the attribute and the attribute value is
images/blueberry_smoothie.jpg. Nested inside the <img> tag is the src attribute
and its value. It links to an image that is then rendered on the page. Other examples
of image attributes are the alt attribute, which provides a text version of an image to
devices such as screen readers and the width and height attributes which defi ne the
size of the image on the page.
3 An external style sheet is a text document with the extension .css. This document
contains CSS rules that defi ne the appearance of HTML elements. Because external style
sheets can be linked to multiple HTML pages, they provide one central location for your
styles. One benefi t to this is the ability to update the style of an entire site with a single
change to a CSS rule. Other benefi ts include the ability to use multiple style sheets for
organizational purposes, and to specify specifi c style sheets for printing or optimize the
display for mobile devices.