Formatting Text with CSS

Slides:



Advertisements
Similar presentations
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Advertisements

Cascading Style Sheets
Introduction to CSS.
Cascading Style Sheets Basics. Why use Cascading Style Sheets? Allows you to set up a series of rules for all pages in a site. The series may be changed.
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
กระบวนวิชา 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.
Chapter 8 Creating Style Sheets.
Tutorial 3 Introducing Cascading Style Sheets. XP New Perspectives on Blended HTML, XHTML, and CSS2 Objectives Learn about Cascading Style Sheets Write.
Chapter 6 Web Typography
Week 7 Web Typography. 2 Understanding Type Design Principles.
Using Cascading Style Sheets CSS Basics. Goals Understand basic syntax of Cascading Style Sheets (CSS) Understand basic syntax of Cascading Style Sheets.
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
Using Cascading Style Sheets CSS Structure. Goals Understand how contextual, class and ID selectors work Understand how contextual, class and ID selectors.
4.01 Cascading Style Sheets
Using Cascading Style Sheets. Introduction to Styles and Properties  Cascading Style Sheets (CSS) are a standard set by the World Wide Web Consortium.
Chapter 7 Web Typography Principles of Web Design, 4 th Edition.
Principles of Web Design 6 th Edition Chapter 5 – Web Typography.
Using Styles and Style Sheets for Design
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
Unit I Applying Advanced Styling CSS. CSS3 can style many aspects that in the past required integration of images New features are not supported by all.
Microsoft Expression Web 3 – Illustrated Unit D: Structuring and Styling Text.
HTML5 and CSS3 Illustrated Unit C: Getting Started 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.
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 3 Introducing Cascading Style Sheets.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
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.
Laying out Elements with CSS
Working with Cascading Style Sheets
HTML WITH CSS.
Web Development & Design Foundations with XHTML
Getting Started with CSS
CS3220 Web and Internet Programming CSS Basics
HTML5 and CSS3 Illustrated Unit D: Formatting Text with CSS
4.01 Cascading Style Sheets
Inserting and Working with Images
Tutorial 4 Topic: CSS 3.0 Li Xu
Creating Page Layouts with CSS
Advanced CSS BIS1523 – Lecture 20.
Using Cascading Style Sheets Module B: CSS Structure
Introduction to Web programming
Creating Visual Effects and Animation
CSS3 Cascading Style Sheet
Web Systems & Technologies
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Website Design 3
Introduction to CSS.
Introduction to Web programming
CSS Borders and Margins.
CSS Style Sheets: Intro
Cascading Style Sheets Color and Font Properties
Web Development & Design Foundations with H T M L 5
What are Cascading Stylesheets (CSS)?
Cascading Style Sheets™ (CSS)
Using Cascading Style Sheets (CSS)
SEEM4570 Tutorial 3: CSS + CSS3.0
Tutorial 3 Working with Cascading Style Sheets
Tutorial 4 Creating Special Effects with CSS
CS3220 Web and Internet Programming CSS Basics
Chapter 7 Web Typography
Exercise 9 Skills You create and use styles to create formatting rules that can easily by applied to other pages in the Web site. You can create internal.
CS3220 Web and Internet Programming CSS Basics
Made By : Lavish Chauhan & Abhay Verma
Cascading Style sheet. What is CSS?  CSS stands for Cascading Style Sheets  Cascading: refers to the procedure that determines which style will apply.
Cascading Style Sheets
4.01 Cascading Style Sheets
Session IV Chapter 15 - How Work with Fonts and Printing
Cascading Style Sheets™ (CSS)
Presentation transcript:

Formatting Text with CSS

Objectives Assess web fonts Declare a font family Use a custom font Declare font size and line height Implement bold and italics HTML5 and CSS3 – Illustrated, 2nd Edition

Objectives (continued) Style pseudo-elements Specify hex and RGB colors Add shadows Create a media query HTML5 and CSS3 – Illustrated, 2nd Edition

Assess Web Fonts Web page font display limited by fonts available on users’ machines How to implement fonts consistently: Specify multiple font families Font stack: List of font families in order of preference, separated by commas Specify a generic font family Generic font families: grouping of font families according to shared characteristics Add to end of font stack HTML5 and CSS3 – Illustrated, 2nd Edition

Assess Web Fonts (continued) How to implement fonts consistently (continued): Use downloadable fonts User agent downloads and applies fonts not installed on user’s computer Upload file containing elements of the font family to web publishing location or reference licensed downloadable font Add @font-face rule to style sheet Indicates font name and location of necessary files HTML5 and CSS3 – Illustrated, 2nd Edition

Assess Web Fonts (continued) Commonly used font stacks Generic font families HTML5 and CSS3 – Illustrated, 2nd Edition

Declare a Font Family font-family property: Used to specify fonts in CSS Value is font stack that includes font family name(s) and ends with generic font family name Can be included in any style rule to apply to elements selected in that rule Test all fonts in your font stack Use browser developer tools to test and not permanently changing the CSS code HTML5 and CSS3 – Illustrated, 2nd Edition

Declare a Font Family (continued) Code with font-family declarations and display HTML5 and CSS3 – Illustrated, 2nd Edition

Use a Custom Font Custom fonts help to Available online, e.g. Create uniformity Add wider font possibilities Available online, e.g. Google.com/fonts Defaults to only the normal version of font Make selections to make other versions, such as bold or italic, available HTML5 and CSS3 – Illustrated, 2nd Edition

Use a Custom Font (continued) Code with link element to custom font Custom font added to font stack HTML5 and CSS3 – Illustrated, 2nd Edition

Declare Font Size and Line Height font-size property: used to specify font size of an element Can specify size in many different units Useful to specify font-sizes in style sheet to standardize visual display of font size in different browsers Specify html element in px Specify other elements in em or rem HTML5 and CSS3 – Illustrated, 2nd Edition

Declare Font Size and Line Height (continued) By default, each font family includes blank space above and below every line of text Use line-height property to set minimum amount of vertical space each line occupies Adjusting line-height helps create white space, which is used for visual effect HTML5 and CSS3 – Illustrated, 2nd Edition

Declare Font Size and Line Height (continued) Code and resulting presentation HTML5 and CSS3 – Illustrated, 2nd Edition

Implement Bold and Italics Bold and italics often applied to words or phrases Use span element to isolate specific sections for formatting: span element creates an inline element Does not fill space of parent element Is not rendered with line breaks before or after Assign class value to span element HTML5 and CSS3 – Illustrated, 2nd Edition

Implement Bold and Italics (continued) CSS font properties to format text Font-weight for bold Font-style for italic HTML5 and CSS3 – Illustrated, 2nd Edition

Implement Bold and Italics (continued) Span element added span element rendered HTML5 and CSS3 – Illustrated, 2nd Edition

Style Pseudo-Elements Pseudo-element: selector that enables you to isolate a portion of a larger element for styling Selector format example article p:first-line Create a drop cap Use :first-letter pseudo-element Use float property Use line-height property HTML5 and CSS3 – Illustrated, 2nd Edition

Style Pseudo-Elements (continued) CSS pseudo-elements HTML5 and CSS3 – Illustrated, 2nd Edition

Style Pseudo-Elements (continued) Code for :first-line and :first-letter pseudo-elements HTML5 and CSS3 – Illustrated, 2nd Edition

Style Pseudo-Elements (continued) Pseudo-elements rendered in browser HTML5 and CSS3 – Illustrated, 2nd Edition

Specify Hex and RGB Colors color and background-color properties: used to specify the color of text and other HTML elements Four ways to specify colors: color name hexadecimal format rgb format, includes rgba hsl format, includes hsla HTML5 and CSS3 – Illustrated, 2nd Edition

Specify Hex and RGB Colors (continued) CSS color systems HTML5 and CSS3 – Illustrated, 2nd Edition

Specify Hex and RGB Colors (continued) Code using hex and rgb colors HTML5 and CSS3 – Illustrated, 2nd Edition

Specify Hex and RGB Colors (continued) hex and rgb color codes rendered in a browser HTML5 and CSS3 – Illustrated, 2nd Edition

Add Shadows text-shadow: creates the appearance of a shadow behind text box-shadow: creates the appearance of a shadow behind an element text-shadow and box-shadow both Support four values: horizontal offset, vertical offset, blur, and shadow color box-shadow also supports Spread distance and inset HTML5 and CSS3 – Illustrated, 2nd Edition

Add Shadows (continued) Syntax of the text-shadow and box-shadow properties HTML5 and CSS3 – Illustrated, 2nd Edition

Add Shadows (continued) Examples of text-shadow and box-shadow HTML5 and CSS3 – Illustrated, 2nd Edition

Add Shadows (continued) Code for text-shadow and box-shadow and resulting web page HTML5 and CSS3 – Illustrated, 2nd Edition

Create a Media Query Media queries: used to create a group of rules for a specific device Starts with @media Lists one or more values for media type Media type values for media queries HTML5 and CSS3 – Illustrated, 2nd Edition

Create a Media Query (continued) Code for media query for printed output HTML5 and CSS3 – Illustrated, 2nd Edition

Create a Media Query (continued) Printed output based on media query HTML5 and CSS3 – Illustrated, 2nd Edition

Summary It is important to implement fonts so that they will be displayed consistently on different user agents Font stacks are declared using the font-family property span element: generic element used to isolate a portion of another element Used to create an inline element HTML5 and CSS3 – Illustrated, 2nd Edition

Summary (continued) Use custom fonts to widen font possibilities and to create uniformity Different aspects of font can be set using CSS properties, such as: font-size property: set the font size font-weight property: make font bold font-style property: make font italic Use line-height property to create space above and below every line of text HTML5 and CSS3 – Illustrated, 2nd Edition

Summary (continued) span element: generic element used to isolate a portion of another element Used to create an inline element Used to apply bold/italic to text specified by span element Pseudo-elements to style a portion of an element :before and :after allow you to generate repeated content from style rules, without changing HTML code HTML5 and CSS3 – Illustrated, 2nd Edition

Summary (continued) In CSS, colors specified by name, rgb/rgba, hex, or hsl/hsla value color property: sets font color background property: sets background color text-shadow and box-shadow properties used to create shadows both support: horizontal/vertical offset, blur radius, color box-shadow only supports: spread distance, inset HTML5 and CSS3 – Illustrated, 2nd Edition

Summary (continued) Media query specifies style rules for a specific device Starts with @media Supports media type values: all, print, screen, and speech HTML5 and CSS3 – Illustrated, 2nd Edition