Web Design - Web Authoring / Intro to CSS: CSS Basics and Type Selectors

Sections:  Introduction  |  Section 1  |  Section 2  |  Section 3
Section One:  Part A  |  Part B  |  Part C  |  Part D  |  Part E  |  Part F  |  Part G

What Are Type Selectors?

Type Selectors

CSS rule

Type selectors are the most basic form of selector. With a type selector, the selector itself is an HTML tag. Note that the selector listed in our example image a p. This means any formatting changes that are listed in in the declaration section of the style will be immediately added to each <p> tag in your HTML document. You can create rules for almost all HTML tags; to include the <body> tag.

Adding Type Selector Rules to Your HTML Document

To add a Type Selector CSS style rules as an Internal Style Sheet implies that we add the style rules directly to our HTML document – doing so, however, can cause problems. As you learned previously, HTML is a markup language and CSS is a style language. These two language are not inherently compatible. In order to make them compatible, information needs to be added to the HTML document using HTML language that informs the document, and subsequently the web browser, that an additional language - in this instance CSS - will be used. Think about it this way...when you create an HTML document you begin the document with the <html> tag to tell the web browser exactly which markup language is being used in the document so that the page will be displayed correctly. When we add CSS to an HTML document we need to be sure we let the web browser know what type of markup language it is so that it, too, can be displayed correctly.

All internal style rules (to include type selector rules) are added between <style></style> tags, which are nested within the <head></head> tags.

Next Next

© 2008 KCDL. All rights reserved.