Presentation is loading. Please wait.

Presentation is loading. Please wait.

XP Introducing Cascading Style Sheets With Cascading Style Sheets (CSS), you can create one or more documents that control the appearance of some or all.

Similar presentations


Presentation on theme: "XP Introducing Cascading Style Sheets With Cascading Style Sheets (CSS), you can create one or more documents that control the appearance of some or all."— Presentation transcript:

1 XP Introducing Cascading Style Sheets With Cascading Style Sheets (CSS), you can create one or more documents that control the appearance of some or all the pages at your Web site – Greater consistency in your Web site – Easily modified code – More flexible formatting Across-the-board compatibility with all browsers is called cross-browser support – No browser supports all features of CSS New Perspectives on Blended HTML, XHTML, and CSS1

2 XP Comparing HTML Code to CSS Code New Perspectives on Blended HTML, XHTML, and CSS2

3 XP Creating a CSS Rule In a text document, type the selector followed by a left brace, as in the following code, and then press the Enter key. selector { Type the declarations, separating a property from a value with a colon, and then type a semicolon, as in the following code. property:value; Type a right brace to end the declaration list. The following code shows the syntax for a complete rule selector { property1:value; property2:value; } New Perspectives on Blended HTML, XHTML, and CSS3

4 XP Guidelines for Writing CSS Rules When writing CSS rules, make sure you include the following parts of the code: – Left brace before the declaration list – Colon between each property and its value – Semicolon at the end of each declaration – Right brace at the end of the declaration list – Spacing, indentation, line returns, or the position of the braces are irrelevant New Perspectives on Blended HTML, XHTML, and CSS4

5 XP Using the Three Types of CSS Styles An external style is one in which you write the CSS code in a document separate from the HTML for the Web page An embedded style is one in which you write the CSS code in the section of an HTML document An inline style is one that is written in the section of an HTML document New Perspectives on Blended HTML, XHTML, and CSS5

6 XP Creating an Embedded Style Embedded styles apply styles locally to a single Web page New Perspectives on Blended HTML, XHTML, and CSS6

7 XP Changing the Font In CSS, styles are grouped according to their function. One of the most commonly used groups is the font properties New Perspectives on Blended HTML, XHTML, and CSS7

8 XP Changing the Font New Perspectives on Blended HTML, XHTML, and CSS8

9 XP Changing the Font You use the font-size property to change the size of type New Perspectives on Blended HTML, XHTML, and CSS9

10 XP Changing the Font You use the font-variant property to display lowercase text in small caps, which is smaller than regular capitals The font-family property changes the typeface New Perspectives on Blended HTML, XHTML, and CSS10

11 XP Changing the Font New Perspectives on Blended HTML, XHTML, and CSS11

12 XP Setting Other Properties to Style Text The CSS line-height property changes vertical spacing between lines of text, a feature not available in HTML – margin property New Perspectives on Blended HTML, XHTML, and CSS12

13 XP Setting Other Properties to Style Text New Perspectives on Blended HTML, XHTML, and CSS13

14 XP Using the font Shortcut Property The font property is a shortcut property, which means you can use it to specify more than one declaration at a time – font-style – font-weight – font-variant – font-size – line-height – margin – font-family New Perspectives on Blended HTML, XHTML, and CSS14

15 XP Using Color on a Web Page In HTML code, you can refer to colors in several ways—by name, RGB value, hexadecimal value, or “short hex” value RGB values are based on the intensity of red, green, and blue The hexadecimal values for colors represent the intensity of red, green, and blue New Perspectives on Blended HTML, XHTML, and CSS15

16 XP Using Color on a Web Page New Perspectives on Blended HTML, XHTML, and CSS16

17 XP Using the color Property The CSS color property changes the foreground color, which determines the color of text New Perspectives on Blended HTML, XHTML, and CSS17

18 XP Setting the background-color Property You use the background-color property to change the background color of an element New Perspectives on Blended HTML, XHTML, and CSS18

19 XP Grouping Selectors If you want more than one HTML selector to have similar declarations, you do not have to create a separate rule for each selector New Perspectives on Blended HTML, XHTML, and CSS19

20 XP Using Contextual (Descendent) Selectors In HTML, you can nest tags to apply multiple formatting features to the same text You can nest CSS code by specifying a selector within another selector, which is called a contextual selector New Perspectives on Blended HTML, XHTML, and CSS20

21 XP Using the display Property The display property is one of the CSS classification properties New Perspectives on Blended HTML, XHTML, and CSS21

22 XP Creating and Applying an Inline Style To create and apply an inline style, you place the style code within the tag in the HTML document where you wish the style to take effect New Perspectives on Blended HTML, XHTML, and CSS22

23 XP Creating and Applying an Inline Style New Perspectives on Blended HTML, XHTML, and CSS23


Download ppt "XP Introducing Cascading Style Sheets With Cascading Style Sheets (CSS), you can create one or more documents that control the appearance of some or all."

Similar presentations


Ads by Google