2Lesson 2: Using Cascading Style Sheets (CSS) Technology

Objectives By the end of this lesson, you will be able to:  2.1: Explain the function and purpose of the Cascading Style Sheets (CSS) technology.  2.2: Explain the importance of using style guides when designing sites and documents.  2.3: Define common CSS terms and syntax.  2.4: Apply CSS styles to format pages.  2.5: Develop and apply page layouts with CSS.  2.6: Use CSS to position content and apply document flow.  2.7: Define common CSS positioning schemes.  2.8: Use the CSS Box Model. 2-2 Advanced HTML5 and CSS3 Specialist

Pre-Assessment Questions

1. In CSS, what is the name for a selector, property and value all grouped together? a. Declaration b. Tag c. Structure d. Rule

2. In a CSS style sheet, which of the following determines the image behind the contents of a page? a. The background-image property b. The background attribute of the tag c. The background-image selector in the tag d. The img property

3. What is liquid layout?

© 2014 Certification Partners, LLC. — All Rights Reserved. Version 1.0 Lesson 2: Using Cascading Style Sheets (CSS) Technology 2-3

Cascading Style Sheets (CSS)

OBJECTIVE As a Web designer, you know that there is more to creating a good Web page than posting 2.1: CSS technology good written content and images. Most users have multiple sites to choose from when they are searching the Web for something, whether it is information, entertainment or products. If several reputable sites offer the same content and are easy to use, then which one will users prefer? Quite often, it will be the one that looks the best.

Cascading Style Cascading Style Sheets (CSS) is a Web design technology that enables developers to Sheets (CSS) A W3C language for determine how the HTML elements in their Web pages will display, giving a page or entire applying structure site a particular "look and feel." and formatting instructions to HTML CSS instructions can be: pages and other markup language documents. • Applied inline to individual HTML elements on an HTML page. • Embedded within an HTML page to affect all specified elements on that page. • Collected in an external file that is linked to multiple HTML pages.

® CIW Online Resources – Movie Clips Visit CIW Online at http://education.Certification-Partners.com/CIW to watch a movie clip about this topic. Lesson 2: Using Cascading Style Sheets (CSS) Technology

External style sheets An external CSS file, or style sheet, is a text file that contains CSS formatting instructions to define the font, color and position of elements used on any markup page(s) to which you attach the style sheet.

NOTE: CSS benefits include: Have you experienced any • Consistency — CSS easily gives an entire site a consistent look and feel. benefits from using CSS in your past • projects? How has Easy change management — You have the ability to change the look and feel of an CSS helped you? Do entire site by simply changing one part of a single line of code, rather than having to you think it is change possibly thousands of lines in hundreds of Web pages. absolutely necessary? Are If all pages on your site are linked to the same external style sheet, then one simple there situations when it is not change to the style sheet will change all associated elements across the site. For example, necessary? if you want to change your

heading styles, you do not need to change every page manually. Simply change one line in a style sheet file attached to all your pages, and then all your

headings will change their appearance to conform to the style sheet.

This technology can save a great deal of development and maintenance time, as well as provide a more consistent, accessible interface for your Web site. Style Guides

OBJECTIVE A style guide or style manual is a set of standards for the writing and/or design of 2.2: Style guides documents, either for general use or for a specific publication, organization or field. Implementing a style guide provides uniformity in style and formatting within a document and across multiple documents.

© 2014 Certification Partners, LLC. — All Rights Reserved. Version 1.0 2-4 Advanced HTML5 and CSS3 Specialist

Style guides are common for general and specialized use, especially for those who write, edit and/or design documents in the following fields:

• Various academic disciplines (both students and scholars) • Journalism • Technology • Medicine • Law • Government • Business and industry Some organizations follow a CSS style guide to define the CSS formatting to be used for all Web documents across the organization. It defines styles such as the page layout, font sizes, colors, and image placement for Web sites. Following a CSS style guide creates consistency in appearance for an organization's communications.

Many companies create their own CSS Style Guides and some even share them with other organizations (Figure 2-1). Google and WordPress make them available to the public:

• Google HTML/CSS Style Guide (http://google-styleguide.googlecode.com/svn/trunk/htmlcssguide.xml) • WordPress CSS Coding Standards (http://make.wordpress.org/core/handbook/coding-standards/css/)

Figure 2-1: Google CSS style guide Following are some examples of guidelines and tips from the Google HTML/CSS Style Guide:

• Be consistent — When editing existing code, for example, match the written code style (spacing, comment use, etc.). If code that you add to a file looks drastically different from the existing code around it, other users of the code can become distracted or even confused. The purpose of style guidelines is to provide a common vocabulary for coding. Global style rules are helpful in general, but local style (dictated by your organization) is also important.

© 2014 Certification Partners, LLC. — All Rights Reserved. Version 1.0 Lesson 2: Using Cascading Style Sheets (CSS) Technology 2-5

• Capitalization — Use only lowercase letters for your code, including HTML element names, attributes, attribute values, CSS selectors, properties and property values. • Declaration order — In a style sheet, alphabetize your declarations to create consistent code that is easy to remember, search and maintain. For example: background: fuchsia; border: 1px solid; border-radius: 4px; color: black; text-align: center; text-indent: 2em; CSS and HTML CSS was created to solve a problem with HTML. The developers of HTML intended it to identify only the content and structure of a document, such as and <body>, not the style, look and feel of the content. </p><p>Before style sheets, the HTML standard introduced many style elements that quickly complicated the language. Developers had to check each page of a Web site to ensure it had the correct HTML style tags for each element. Imagine the time and difficultly involved with this task. </p><p>To save developers from many headaches, the W3C quickly went into action and standardized CSS, which greatly simplifies the definition and use of styles. Today a style, such as a background color or image, can be added to all Web pages with one change to an external CSS file. </p><p>CSS versions Currently, three standards exist for style sheets: </p><p>• Cascading Style Sheets (CSS1) — governs the basic structure of style sheets. • Cascading Style Sheets 2 (CSS2) — adds more capabilities to the CSS1 specification, including the ability to support media types (such as specific printers) and work with tables. </p><p>NOTE: • Cascading Style Sheets 3 (CSS3) — provides a modularized standard so that when Remember that changes must be made to a style, only a particular module within CSS3 will need to HTML5, CSS3 and JavaScript are be updated, rather than the entire standard. This will allow for a more flexible and considered the timely upgrade of the CSS standard as a whole. New functions are being added to future of Web development as CSS3 to enhance its support of borders, backgrounds, colors, text effects and so mobile devices forth. continue to proliferate. HTML5 adopts CSS as the preferred way to format a page. The CSS standard has evolved over the years and continues to build upon itself. For instance, HTML 4.01 and XHTML 1.0 used CSS1 and CSS2. HTML5 uses CSS1, CSS2 and CSS3. Any given Web page may include CSS rules from all three versions. </p><p>HTML5, CSS and legacy browsers Because CSS3 contains the latest instructions, most non-HTML5-compliant browsers cannot interpret it. Most of the basic Web page formatting uses CSS1 and CSS2. CSS3 provides advanced features to extend a Web page’s functionality beyond basic formatting. </p><p>HTML5 is not supported by <a href="/tags/Internet_Explorer/" rel="tag">Internet Explorer</a> 8 or earlier. This is a challenge because Windows XP cannot run IE9, which is the first Internet Explorer version that supports </p><p>© 2014 Certification Partners, LLC. — All Rights Reserved. Version 1.0 2-6 Advanced HTML5 and CSS3 Specialist </p><p>HTML5. The simple solution is to install the latest version of the Chrome or <a href="/tags/Firefox/" rel="tag">Firefox</a> browser on Windows XP or Vista systems. </p><p>But what about your site visitors? You cannot force them to install Chrome or Firefox. They may be using IE8, 7 or 6. The only way to support these older IE browsers is to add JavaScript code to your HTML documents and a new rule to CSS. </p><p>Because older IE browsers will not recognize the new HTML5 elements (such as <header>, <footer>, <article>, etc.), you must use JavaScript to create these elements in your Web pages so that older IE browsers will recognize them. This requires several steps, as follows. </p><p>NOTE: You can try coding HTML5 document additions for older IE browsers a page to support At a minimum, you should create the basic HTML5 structural elements by adding the legacy browsers in following JavaScript in the <head> element: Optional Lab 2-1: Supporting legacy browsers. <script> document.createElement("article"); document.createElement("footer"); document.createElement("header"); document.createElement("nav"); </script> </p><p>CSS document additions for older IE browsers The new HTML5 structural elements must also become block-level elements in CSS for consistent styling. A block-level element is a large block of content, such as a paragraph or a structural element that starts a new line of text or a new section. The following CSS code can do this: </p><p> header, nav, article, footer { display: block; } </p><p>Script for enabling HTML5 elements for older IE browsers Now you must add each new HTML5 element to your document. This task can be long and laborious. One solution is to implement a script developed by Remy Sharp, available at http://remysharp.com/2009/01/07/html5-enabling-script. </p><p>Instructions for enabling the script are included at this site. Remy Sharp's code has been utilized by Google, MIT and nearly all Web developers across the globe. It is the de facto standard for supporting HTML5 in older IE browsers. </p><p>This technique of using JavaScript to force IE to acknowledge new HTML5 elements is sometimes called the HTML5 shiv. CSS Terms and Syntax </p><p>OBJECTIVE CSS allows you to change the style attributes of a Web site quickly and efficiently. The 2.3: CSS terms and most important CSS terms to understand are: syntax • Selector. • Property. • Value. • Declaration. • Rule. </p><p>© 2014 Certification Partners, LLC. — All Rights Reserved. Version 1.0 Lesson 2: Using Cascading Style Sheets (CSS) Technology 2-7 </p><p>This section will review some of the basic CSS concepts and code. </p><p>The following code from a CSS file illustrates the anatomy of these style sheet elements as they are found in linked, or external, style sheets. </p><p> body {background-color: #ADD8E6;} </p><p>NOTE: Table 2-1 lists terms for the syntax examples in this CSS code. Be sure you do not confuse CSS terms, Table 2-1: CSS syntax terms syntax and declaration with HTML code. Term CSS Syntax Example Although used together, CSS and Selector body HTML are separate technologies. Opening curly brace { Property background-color: Value #ADD8E6; Closing curly brace } </p><p>This CSS file entry creates a light blue background color for the Web document. </p><p>CSS selector In a style sheet, any CSS selectors, properties and values HTML element to which designated To make such a change, you must first identify the HTML element to which you want to styles are applied. apply the style. Any element you want to affect with a CSS style is called a selector. In this example, the selector is the <body> element. NOTE: Selectors are most easily used with After you have chosen a selector, you can customize it by selecting a property and setting standard elements. a value. By selecting a property, you will change the way the selector renders in the They can also be applied based on browser. For example, you could alter the selector's color, size, background, font family, basic patterns. For font size and so forth. These changes will apply to all subsequent instances of the example, you can element you define as a selector. declare a selector that will apply to Most CSS values do not require quotation marks. Some do require them, such as paragraphs <p> a font name that contains whitespace. Also, CSS syntax should be written in that fall within lowercase. Although this is best practice, CSS is case-insensitive except for class tables. Or you can and id names. group selectors to apply the same styling information A property must then have a value. For example, if you want to change a selector's size to multiple elements with a single property, you must set a value to specify that size. Or you could decide to change the declaration. background color of your pages to teal, and so forth. </p><p>CSS declaration In a style sheet, a CSS declarations and rules property and a value applied to The following example shows a CSS declaration, which consists of a property and a format a specified value. A declaration must always end with a semicolon. HTML element (selector). A background-color: #008080; declaration combined with a selector is a CSS The name for a selector, property and value all grouped together is called a rule. The rule. following rule will change the background color of the page's body to teal, then set the </p><p>CSS rule font color to white: In a style sheet, a format instruction body {background-color: #008080; color: #FFFFFF;} that consists of a specified selector and the properties and values applied to it. </p><p>© 2014 Certification Partners, LLC. — All Rights Reserved. Version 1.0 2-8 Advanced HTML5 and CSS3 Specialist </p><p>Table 2-2 compares syntax examples for CSS declarations and rules. </p><p>Table 2-2: CSS declarations vs. rules </p><p>Term CSS Syntax Example </p><p>Declaration background-color: #008080; Rule body {background-color: #008080; color: #FFFFFF;} </p><p>To define multiple declarations for one selector within a rule, as in the previous example, you must separate each declaration with a semicolon. Although optional, you should also place a semicolon between the last value of the declaration and the end bracket. </p><p>Notice from these examples that the properties and the values must be placed within curly braces. This practice is standard for all style sheet rules, except when declaring inline styles. You will learn more about different ways to define styles shortly. </p><p>® CIW Online Resources – Online Exercise Visit CIW Online at http://education.Certification-Partners.com/CIW to complete an interactive exercise that will reinforce what you have learned about this topic. Exercise 2-1: CSS terms and syntax </p><p>Proper CSS rule structure Following is an example of the accepted structure of rules within a style sheet: </p><p> body { font-family: arial, verdana, helvetica; color: #808080; font-size: 14px; } </p><p> h1 { font-family: arial, sans-serif; color: #FFFFFF; font-size: 36px; } </p><p>Notice that the opening curly brace is on the same line as the element. Each declaration is placed on a separate line. These formatting techniques are considered best practices for coding because it makes the CSS file easier to read. </p><p>Comments in style sheets If you want a particular rule in a style sheet to be ignored, you can "comment out" the entry by placing it in between the /* and */ characters. You can also add comments to explain the rules to others. In the following example, the words "STYLE SHEET FOR INDEX.HTM" and "A comment is added here" will not be read: </p><p>/* STYLE SHEET FOR INDEX.HTM */ /* A comment is added here */ </p><p>© 2014 Certification Partners, LLC. — All Rights Reserved. Version 1.0 Lesson 2: Using Cascading Style Sheets (CSS) Technology 2-9 </p><p>Inheritance The concept of inheritance is essential to CSS. In fact, the word "cascading" refers to inheritance. The styles you define in a style sheet will flow, or cascade, throughout the documents to which it is attached, unless another style defined inside of a page specifically overrides it. For example: </p><p>• A style sheet rule will override the default <body> font color, which is black. • Styles embedded in an internal style sheet in an HTML page's code will override styles specified in a linked external style sheet. • Styles specified inline using the style attribute in individual HTML elements within an HTML page will override embedded and external CSS entries. Many styles can be used together to create a completely formatted document. All these characteristics, whether they are defined in a style sheet or exist by default, are inherited throughout the rest of the document(s). </p><p>® CIW Online Resources – Online Exercise Visit CIW Online at http://education.Certification-Partners.com/CIW to complete an interactive exercise that will reinforce what you have learned about this topic. Exercise 2-2: Proper CSS structure </p><p>Applying CSS Styles </p><p>OBJECTIVE Now that you understand basic CSS terminology and syntax, you will learn how to 2.4: Applying CSS implement CSS styles in an HTML document. You can apply CSS to HTML pages in styles several ways. You can: </p><p>• Declare an inline CSS style attribute in an HTML element. • Embed an internal style sheet in an HTML page. • Link an HTML page to an external style sheet. </p><p>NOTE: In this lesson, you will modify an external style sheet to format an HTML page. Although CSS3 is the most current This course does not cover importing style sheets. Certain older browsers may recommendation crash when rendering pages with an import statement. If you want to use an from the W3C, the external style sheet, use a linked style sheet rather than an imported style sheet. support provided by most browsers is still inconsistent. Specifying style information As you now know, CSS allows you to format the appearance of various elements on a Web page, including page backgrounds, images, structural elements, text and so forth. </p><p>For example, you can change the size, color and typeface of the text on a Web page. CSS supports many font-related selectors and properties, including: </p><p>• font-family — specifies the typeface (i.e., font name) to be used. • font-size — takes values in various units, such as em and pixels; the default pixel size is 16. • color — specifies the color of text. </p><p>© 2014 Certification Partners, LLC. — All Rights Reserved. Version 1.0 2-10 Advanced HTML5 and CSS3 Specialist </p><p>If you specify a font that is not available on all systems, some users will not see the font face you chose. Instead, the font will display as a default font face. Be aware of this when planning your page and include backup font-family values. </p><p>You specify style information using properties and values regardless of whether you insert them inline to HTML elements, or list them with selectors in an embedded or external style sheet. </p><p>Linking to an external style sheet You can link an HTML file to an external style sheet using the HTML <link> element. The <link> element specifies any external resource for the HTML document, but is usually used to link to an external style sheet. </p><p>You place the <link> element in the <head> section of your HTML file. It is an empty element that can appear multiple times and contains only attributes. The <link> element attaches your HTML file to the CSS file you specify. Following is an example: </p><p><head> <link rel="stylesheet" type="text/css" href="css/habitat.css"/> <title>

Multipurpose • The rel attribute is required and defines the relationship between the HTML Internet Mail Extensions (MIME) document and the linked document. Defines the file type, such as text or • The type attribute specifies the linked document’s MIME type. video, and the extension, such as • The href attribute specifies the location of the linked document. css or mp4, for a user agent or The external CSS file to which you link is a separate text file with a .css file name browser. extension. It contains only CSS style rules, no HTML.

Applying CSS styles in other ways Although this course focuses on applying CSS by linking to external style sheets, it is worthwhile to note the other ways you can apply CSS to an HTML page.

Embedding an internal style sheet Embedding styles in an HTML page is useful when:

• You have styles that you want to apply consistently to an entire page but not necessarily more than one page. • You want to apply one or more styles on a single page that will override styles applied to the same element(s) by an external style sheet. To embed CSS in a single Web page as an internal style sheet, you add the block. For example:

© 2014 Certification Partners, LLC. — All Rights Reserved. Version 1.0 Lesson 2: Using Cascading Style Sheets (CSS) Technology 2-11

Applying an inline style Applying an inline style in an HTML page is useful when:

• You have a style that you want to apply to an element on a single page but not to every occurrence of that element on that page. • You want to apply a style that will override other styles applied to that same element on that page (by an external style sheet or embedded style). To apply an inline style to an HTML element in a Web page, you add the style attribute directly into the element tag to which you want to apply the style. These styles are applied to elements individually in the section of the HTML, rather than page- wide in the section. For example:

Introduction

In the following lab, you will format text on a Web page using an external style sheet. Suppose your Web team agrees that you should experiment with one of the site pages to see if a different font style would work well. You can use CSS to try some different font formatting styles on the page quickly and easily, with a minimum of recoding.

Lab 2-1: Formatting text with CSS

OBJECTIVE In this lab, you will use CSS to format text in an HTML5 page. The formatting will affect 2.4: Applying CSS styles the fonts, the font size, and alignment.

1. Windows Explorer: Copy the Lesson02 folder from your student lab files to your Desktop. NOTE: Using a percentage 2. Editor: Access the Lab_2-1 folder and open the css\habitat.css file. Insert the text- value (%) for font formatting declarations exactly as shown in bold below: size helps maximize flexibility for display, which is especially /* STYLE SHEET FOR INDEX.HTM */ important for adapting to mobile body { devices. The value font-size: 80%; will be the specified font-family: arial, helvetica, geneva, sans-serif; percentage (in this } case, 80%) of the font's default size, footer { which is generally 16 font-size: 80%; points. text-align: center; }

h1 { font-family: arial, helvetica, geneva, sans-serif; }

3. After you have inserted this code, save your changes to habitat.css.

4. Editor: Open the index.htm file. Insert the element in the section as shown in bold below to attach the style sheet to this HTML page:

© 2014 Certification Partners, LLC. — All Rights Reserved. Version 1.0 2-12 Advanced HTML5 and CSS3 Specialist

Habitat for Humanity Int'l

Tech Note: The name of the style sheet file is habitat.css. In the href attribute, you specify the location of this file in your file structure, so in this case you specify href="css/habitat.css" because the habitat.css file resides in a folder named css. If the style sheet were in the same folder as the HTML file, you would give the location as href="habitat.css".

5. After you have inserted this code, save your changes to index.htm.

6. Browser: Open index.htm. It should resemble Figure 2-2.

Figure 2-2: Text formatted using CSS

7. Close your and text editor.

In this lab, you used CSS to format text in an HTML5 page.

With practice, you can embellish your HTML pages quickly and easily by using CSS to add graphical elements and styles.

Class and id selectors class selector Sometimes you must apply a specific style to a group of elements. In other cases, you A selector that specifies CSS styles need to apply a style only to one unique element. CSS allows you to customize your own for a group of element styles using the class and id selectors. elements. id selector The class selector A selector that The class selector specifies a CSS style that you can apply to a group of elements. For specifies CSS styles for one unique example, you can apply a font color style to several elements at once, such as headings, element. paragraphs and footers.

© 2014 Certification Partners, LLC. — All Rights Reserved. Version 1.0 Lesson 2: Using Cascading Style Sheets (CSS) Technology 2-13

When using class selectors, you create the selector in your CSS file, then add the class attribute inline to HTML elements with the value you named in your CSS file. The class selector always starts with a period ( . ) in CSS, although the period is not included in the HTML. In the following example, elements with the class="right" attribute will be right- justified.

CSS file:

.right { text-align: right; }

HTML file:

Right-aligned heading level three

Right-aligned paragraph

If only one HTML element needs to be affected by the style, then add that element name before the period in the CSS rule. In the following example, only

elements are affected:

CSS file:

h3.right { text-align: right; }

HTML file:

Right-aligned heading three

Not affected. Only H3s receive the style

The id selector The id selector specifies CSS styles for one unique element, such as one paragraph that requires red text. Like class selectors, you define your id selectors in your CSS file, then apply them as inline styles to HTML elements in the HTML file.

The id selector always starts with the pound or hash symbol ( # ) in CSS, whereas the # symbol is not included in HTML. In the following example, the paragraph with id="red" will have red text.

CSS file:

#red { color:red; }

HTML file:

This paragraph has red text

Not affected

To help remember these terms, consider the following: • An ID is a unique identifier for one person, such as an identification (ID) card. • A class is an identifier for a group of people, such as a classroom of students.

The class and id selectors are very helpful because they give you a great deal of flexibility with your styles.

© 2014 Certification Partners, LLC. — All Rights Reserved. Version 1.0 2-14 Advanced HTML5 and CSS3 Specialist

® CIW Online Resources – Online Exercise Visit CIW Online at http://education.Certification-Partners.com/CIW to complete an interactive exercise that will reinforce what you have learned about this topic. Exercise 2-3: CSS styles and selectors

Page Layout with CSS

OBJECTIVE Web page layout is the placement of all page elements — including text, images, 2.5: Page layout headings, navigation menus and so forth — relative to each other. A good page layout with CSS makes the page aesthetically pleasing, and easy to scan, read and navigate. Following are 2.6: Positioning some layout guidelines to consider when designing your Web pages: content with CSS • Be succinct — Limit words to clear, necessary verbiage, especially on the home page. Most users simply scan pages quickly looking for specific information or links to it. Let users navigate to additional pages if they want more information. • Make sure that each page focuses on one topic — No tangent message, regardless of its importance, should be added to a page. Use links to point users to appropriate related topics on separate pages. • Include navigation aids — A common way to enable navigation is to place links at the top and bottom of the page, and within the body of the page, to reduce the need for users to scroll. • Place comments in each section of code — Comments help explain changes you have made to the code or page. You can indicate the nature of the change, including the date you made the change and your name or initials, or you can explain the nature of the markup. For example, the syb.html page has three headings (h1, h2 and h3). You could comment each of these sections of the narrative.

Effective page layout is essential for effective search engine optimization.

document flow Positioning content on a page is similar to positioning document structure elements. It is In CSS, the arrangement of important to pay attention to content positioning, because this creates the document content elements flow for your page. Document flow describes how your content is positioned: Does it fall on a page and how from top to bottom in stacks, or does some content float to one side or the other? the space is used. By default, browsers render block-level elements with blank space above and below them, whereas inline elements are rendered within other elements. However, you can use CSS to modify element positioning.

Fixed-width vs. liquid design layouts Web designers have no control over their site users' browser window sizes, the Web browsers used or the fonts installed on users' computers. Yet despite this, many designers try to control the way that Web page elements will render on the screen.

There are two page-layout methods that designers use to control the placement of Web page elements when rendered in the browser:

© 2014 Certification Partners, LLC. — All Rights Reserved. Version 1.0 Lesson 2: Using Cascading Style Sheets (CSS) Technology 2-15

• Fixed-width layout —achieved by assigning specific pixel widths to elements using the HTML5 structural elements or the

tag. This layout ensures that the text, images and layout will not vary from browser to browser. The problem with using a fixed-width layout is that the elements may not render as expected when users change the size of their browser windows. • Liquid layout — also known as relative width or fluid layout. Achieved by assigning percentage values to elements. With this layout, the size of an element is flexible and will change dynamically depending on the size of the browser window. For example, you can specify in the CSS width property that Element A will occupy 35 percent of the screen and Element B will occupy the remaining 65 percent. If the user resizes the browser window, the elements will resize correspondingly. Whether you design a fixed-width or liquid layout depends on your goal. If you design for mobile devices, consider liquid layout. If you design for desktop computers, consider fixed-width layout.

® CIW Online Resources – Online Exercise Visit CIW Online at http://education.Certification-Partners.com/CIW to complete an interactive exercise that will reinforce what you have learned about this topic. Exercise 2-4: Page layout with CSS

Document structure elements and page layout In the previous lesson, you learned the new document structure elements:

,
,
,