Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 3 Introducing Cascading Style Sheets.

Slides:



Advertisements
Similar presentations
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
Advertisements

Part 3 Introduction to CSS. CSS Text Text Styles h1 {color: green} // rgb(0,255,0), #00ff00 h2{letter-spacing: 0.5cm} // 2px h3 {text-align: right} //
กระบวนวิชา CSS. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
Session Objectives Setting the font family Setting the font size Working with Web fonts Setting font faces and sizes Setting font and text appearances.
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.
Tutorial 3 Introducing Cascading Style Sheets. XP New Perspectives on Blended HTML, XHTML, and CSS2 Objectives Learn about Cascading Style Sheets Write.
Week 7 Web Typography. 2 Understanding Type Design Principles.
INTRODUCTORY Tutorial 3 Using CSS to Format Multiple Pages.
Text Properties, Line Box, CSS. Text Properties Properties related to the display of text. Text-align : left, right, center I like FSU!
CSS – CASCADING STYLE SHEETS Making your XHTML webpage look good.
Using Cascading Style Sheets CSS Structure. Goals Understand how contextual, class and ID selectors work Understand how contextual, class and ID selectors.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
3.1 Cascading Style Sheets. Motto Fashions fade, style is eternal. —Yves Saint Laurent.
Formatting Text (Plus More Selectors) Learning Web Design: Chapter 12.
Selectors thru Borders. CSS – Cascading Style Sheets – is a way to style HTML HTML is the content base of a web page CSS provides the presentation qualities.
CSS1-1 Cascading Style Sheets (CSS) Xingquan (Hill) Zhu
1 Working with Cascading Style Sheet (CSS). 2 Cascading Style Sheets (CSS)  a style defines the appearance of a document element. o E.g., font size,
Using Cascading Style Sheets. Introduction to Styles and Properties  Cascading Style Sheets (CSS) are a standard set by the World Wide Web Consortium.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
Chapter 7 Web Typography Principles of Web Design, 4 th Edition.
Principles of Web Design 6 th Edition Chapter 5 – Web Typography.
Cascading Style Sheet (CSS)
Tutorial #3 Cascading Style Sheets. Review: Last Class Image sizing Pathnames Project Default Path Relative Path Absolute Path Blackboard Homework Submission.
Cascading Style Sheets CSS. CSS - Structure Declaration block Property: identifies what to change Value: how to change it Selector – example h1{ font-size:
WORKING WITH CASCADING
New Perspectives on XML, 2nd Edition Tutorial 5 1 TUTORIAL 5 WORKING WITH CASCADING STYLE SHEETS.
XP New Perspectives on XML Tutorial 5 1 TUTORIAL 5 CSS Tutorial – Carey ISBN
Chapter 6 Web Typography. 2 Principles of Web Design Chapter 5 Objectives Understand principles for type design on a Web site Use the element Understand.
INTRODUCTION TO HTML5 Styling Text. Change the Font Size  You can use the font-size property to change the font size for a document’s text.  Instead.
Chapter 12 Cascading Style Sheets: Part II The Web Warrior Guide to Web Design Technologies.
CSS: Cascading Style Sheets. 2 What are Style Sheets A style sheet is a mechanism that allows to specify how HTML (/XHTML/XML) pages should look The style.
CSS – Cascading Style Sheets Fred Durao
(CSS) More Details Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
 A style sheet is a single page of formatting instructions that can control the appearance of many HTML pages at once.  If style sheets accomplished.
Cascading Style Sheets Chapter Four. What are they? A set of style rules that tell the web browser how to present a web page or document. Cascading Style.
Tutorial 5 Formatting with CSS. Objectives Session 5.1 – Evaluate why CSS styles are used – Determine where to write styles – Create an element selector.
Tutorial #3 Cascading Style Sheets. Tutorial #2 Review - Anchors Links to Site DMACC Internal Links Go to Top Mail To me Local.
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
Cascading Style Sheets Robin Burke ECT 270. Outline Midterm The Layout Debate CSS properties Fonts Alignment Color CSS selection selectors pseudo-classes.
INTRODUCTORY Tutorial 3 Using CSS to Format Multiple Pages.
Cascading Style Sheets Eugenia Fernandez IUPUI. CSS Purpose CSS allow you to specify the style in which your XML elements are displayed. CSS were originally.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
1 Working with Cascading Style Sheet (CSS). 2 Cascading Style Sheets (CSS)  a style defines the appearance of a document element. o E.g., font size,
CIS234A Lecture 5 Instructor Greg D’Andrea. Font Styles Review Font-Family: generic family, font family Font-Size: em, pt, px, %, mm, cm, in Font-Style:
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
Web Design (14) CSS Formatting Text. Formatting Text In Brackets, go to your ‘externalcss’ website and find the ‘formattingtext’ page. Use the ‘main’
CSS Cascading Style Sheets *referenced from
Tutorial 3 Designing a Web Page with CSS
Chapter 11 & 12 CSS Style Sheets: Intro. Why CSS? Separate presentation from content – more accessible Less work – can change appearance of whole site.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
1 CS428 Web Engineering Lecture 07 Font, Text & Background (CSS - II)
CSS Details Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  To use CSS properties for fonts  Evaluate whether to use pts,
Cascading Style Sheets Robin Burke ECT 270. Outline CSS properties Fonts Alignment Color CSS selection selectors.
CONFIGURING COLOR AND TEXT WITH CSS Chapter 3. Cascading Style Sheets (CSS) Used to configure text, color, and page layout. Launched in 1996 Developed.
Internet & World Wide Web How to Program, 5/e 1. 2.
CSS.
CS3220 Web and Internet Programming CSS Basics
Madam Hazwani binti Rahmat
Using Cascading Style Sheets Module B: CSS Structure
IS333: MULTI-TIER APPLICATION DEVELOPMENT
CSS Style Sheets: Intro
Cascading Style Sheets Color and Font Properties
Web Development & Design Foundations with H T M L 5
CS3220 Web and Internet Programming CSS Basics
Chapter 7 Web Typography
CS3220 Web and Internet Programming CSS Basics
Cascading Style Sheets
Session IV Chapter 15 - How Work with Fonts and Printing
Cascading Style Sheets™ (CSS)
Presentation transcript:

Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 3 Introducing Cascading Style Sheets

XP Objectives 3.1 Understand the advantages of using CSS Define a style rule Apply color using CSS Create internal and external style sheets Change the appearance of a link using CSS 2New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Objectives 3.2 Explore the five generic fonts Understand the importance of using Web-safe fonts Change the size and decoration properties of text Manipulate the letter spacing, word spacing, and line height of text Set the first line indentation and change text to uppercase using CSS Set alignment to center text horizontally 3New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Introducing CSS Cascading Style Sheets (CSS) is used to format Web pages. CSS offers many advantages, including: – greater consistency in your Web page – easily modified code – more flexible formatting 4New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP History of CSS CSS1 (1996) enabled users to set font size; align text center, left, or right; set body margins; and apply background and foreground colors to page elements. CSS2 (1998) included features such as design styles for different output devices such as print media and aural devices, and controlling the appearance and behavior of browser features. CSS3 (2005) includes text effects such as drop shadows and Web fonts, semitransparent colors, box outlines, and rotating page elements. 5New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Defining a Style Rule Using CSS, you can change how an HTML element appears in browsers. A style rule is the combination of a selector, a property, and a value. The property is the name of a specific feature. The property value provides a setting for the associated feature. The selector identifies the element to which you are applying a style. 6New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP The Structure of a Style Rule selector { h1 { property1: value1; color: yellow; property2: value2; text-align: center; property3: value3;} … } A style sheet is a collection of one or more style rules, either within an HTML document or in a separate CSS document. 7New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Defining Color 16 basic color names are standard in CSS2; a more extensive list of color names was incorporated in CSS3. 8New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition color: color-value;

XP Implementing Inline Styles An inline style rule is a style rule that is embedded inside an HTML start tag. 9New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Embedded Style Sheets The inline style method is discouraged because the power of CSS is its ability to separate the presentation (styles) from the content. An embedded style sheet is a set of style rules contained between the start tag and the end tag in the head section of an HTML document: style rules 10New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Embedded Style Sheets 11New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP External Style Sheets If styles are to be used across several pages in a Web site, it’s much more efficient to create a separate document that contains the styles, known as an external style sheet. Then you should use the link element to link the external style sheet to the Web pages. Comments should be used in style sheets to describe information about the style and to identify its sections. 12New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Background Color Background color can be defined for most elements. The background color for heading elements extends across the Web browser window. The background color can be defined as background-color: color_value; The color value could be the CSS color name, the hex code, or the RGB triplet. 13New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Background Color 14New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition Setting the text color as black in a CSS rule ensures the text will be displayed as black. Style rules are added to the xxx.css style sheet and then this file is linked to the index.htm Web page.

XP The link Element After linking the external style sheet to the Web page, the styles are applied to the elements in the Web page. One style sheet can be linked to many Web pages. More than one style sheet can be linked to the Web page. The link element is used to link an external style sheet to a Web page. 15New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP The link Element The link element is placed in the head section of the HTML code: url refers to the URL of the external style sheet file. rel = "stylesheet" identifies this link item as a style sheet. type = "text/css" identifies it as a CSS text file. 16New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP The link Element 17New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Defining a Style for Links By default, links are underlined and blue. You can change the color of the links using the color property. 18New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Changing the Page Background 19New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Font Families A font is the recognizable, distinct design of a collection of characters in a particular typeface. A font family is a set of fonts that have similar characteristics. A generic font attempts to duplicate as many features of a specific font as possible. There are five generic fonts used in Web page design: serif, sans-serif, monospace, cursive, and fantasy. 20New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Font Families Generic fonts are designed to be cross-platform. The letters in a serif font have finishing strokes. A sans-serif font lacks finishing strokes. A monospace font has a fixed letter width. A fantasy font is artistic and decorative. Cursive fonts resemble handwritten letters. 21New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Web-safe Fonts Web-safe fonts are displayed reliably in most Web browsers on most devices. 22New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP The font-family Property The font-family property is used to change the typeface of text: font-family: Font1, Font2,..., GenericFont; The most common font-family style properties: 23New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Setting the Font Size The style used to change the font size: font-size: size; The font size can be expressed in: – centimeters (cm) – inches (in) – millimeters (mm) – points (pt) – picas (pc) – pixels (px) – x-height (ex) – em – percentages 24 ```` New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition absolute units relative units

XP Setting the Font Size 25 ```` New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Transforming Text Many browsers can transform text to all uppercase characters using the text- transform property. The property’s values are: – capitalize (Text Appears With The First Letter Of Each Word Capitalized) – lowercase (text appears in lowercase) – uppercase (TEXT APPEARS IN ALL CAPS) – none (removes any of the preceding values) 26New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Creating a Spread Heading The letter-spacing property controls the amount of white space between letters: letter-spacing: letter_spacing_value; The word-spacing property controls the amount of white space between words: word-spacing: word_spacing_value ; 27New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Indenting Text Use the text-indent property to indent the first line of paragraph text: text-indent: value; 28New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Adjusting the Line Height Single and double spacing are examples of line height, which is the vertical spacing between lines of text. By default, Web browsers use 1.0em or 1.2em line height. The style used is: line-height: value; 29New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Using the font Shorthand Property The font property is one of several CSS shorthand properties and is used to set a related group of properties in one declaration. Values for the font properties must be listed in the following order: font style, font weight, font variant, font size, font family. 30New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Text Alignment The text-align property is used to change the alignment of the text. The property’s values are: – left – Each line of text is flush with the left margin. – right – Each line of text is flush with the right margin. – center – Each line of text is centered horizontally. – justify – Each line of text is flush with the left and right margins. 31New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Text Alignment 32New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Removing the Underlines on Links Hyperlinks are underlined. Underline is a text decoration and can be removed using the text-decoration property: text-decoration: value; The property’s values are none, underline, or line-through. The style to remove underlines on links: a { text-decoration: none; } 33New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Some Other font Properties To set the font style to italic, use: font-style: italic; To remove italic, use: font-style: none; To set the font weight to bold, use: font-weight: bold; To set the font weight to light, use: font-weight: light; 34New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition

XP Validating the CSS Code Navigate to Use either the ‘By file upload’ or ‘By direct input’ method for validating a document. 35New Perspectives on Blended HTML and CSS Fundamentals, 3 rd Edition