Tutorial 5 Formatting with CSS. Objectives Session 5.1 – Evaluate why CSS styles are used – Determine where to write styles – Create an element selector.

Slides:



Advertisements
Similar presentations
Cascading Style Sheets
Advertisements

CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
CSS Digital Media: Communication and design 2007.
Today CSS HTML A project.
Cascading Style Sheets. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. CSS is a.
1 Web Developer & Design Foundations with XHTML Chapter 9 Key Concepts.
กระบวนวิชา 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.
Web Design with Cascading Style Sheet Lan Vu. Overview Introduction to CSS Designing CSS Using Visual Studio to create CSS Using template for web design.
Ch. 5 Web Page Design – Templates and Style Sheets Mr. Ursone.
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.
Tutorial 2: Formatting Text. Objectives Session 2.1 – Learn the functions of the Common toolbar – Change the size of text – Discern which fonts to use.
Week 7 Web Typography. 2 Understanding Type Design Principles.
INTRODUCTORY Tutorial 3 Using CSS to Format Multiple Pages.
Chapter 3 Working with Text and Cascading Style Sheets.
Web-based Application Development Lecture 5 January 24, 2006 Anita Raja.
Using Cascading Style Sheets CSS Structure. Goals Understand how contextual, class and ID selectors work Understand how contextual, class and ID selectors.
Tutorial 3: Adding and Formatting Text. 2 Objectives Session 3.1 Type text into a page Copy text from a document and paste it into a page Check for spelling.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
Formatting Text (Plus More Selectors) Learning Web Design: Chapter 12.
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.
Chapter 4 Cascading Style Sheets Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Chapter 3 Working with Text and Cascading Style Sheets.
Getting Started with Expression Web 3
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.
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.
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
Just A Few More Fun Objectives 1 Having Some Fun With Java Script 2 Using Style Sheets.
Cascading Style Sheets Orientation Learning Web Design: Chapter 11.
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.
Introduction to CSS CSS Fonts - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Font Control Instructor: Joseph DiVerdi, Ph.D.,
CSS Cascading Style Sheets. CSS Advantages Greater typography and page layout control Style is separate from structure Styles can be stored in a separate.
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 CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
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.
1 Web Development CSS (Cascading Style Sheet). 2 1.Setting rules for multiple elements To decrease the amount of typing for setting rules for multiple.
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,
OV Copyright © 2008 Element K Content LLC. All rights reserved.  Format Text  Format Lists  Format Images  Modify Page Background Applying Styles.
Microsoft Expression Web 3 – Illustrated Unit D: Structuring and Styling Text.
CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS.
Tutorial 3 Designing a Web Page with CSS
CSCE Chapter 3 (Cascading Style Sheets) CSCE General Applications Programming Benito Mendoza 1 By Benito Mendoza Department of Computer.
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.
CSS Details Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  To use CSS properties for fonts  Evaluate whether to use pts,
CSS Introductions. Objectives To take control of the appearance of a Web site by creating style sheets. To use a style sheet to give all the pages of.
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.
CS3220 Web and Internet Programming CSS Basics
Madam Hazwani binti Rahmat
Using Cascading Style Sheets Module B: CSS Structure
CSS Style Sheets: Intro
Cascading Style Sheets Color and Font Properties
Using Cascading Style Sheets (CSS)
Tutorial 3 Working with Cascading Style Sheets
CS3220 Web and Internet Programming CSS Basics
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
Cascading Style Sheets
Presentation transcript:

Tutorial 5 Formatting with CSS

Objectives Session 5.1 – Evaluate why CSS styles are used – Determine where to write styles – Create an element selector style – Implement the font properties on a Web page Session 5.2 – Create a style based on element, class, and ID selectors – Apply and modify styles 2New Perspectives on Microsoft Expression Web 3.0

Objectives – Create an external style sheet – Attach a CSS style sheet to an HTML file – Run a CSS report New Perspectives on Microsoft Expression Web 3.03

Visual Overview The New Style Dialog Box New Perspectives on Microsoft Expression Web 3.04

Introducing Cascading Style Sheets HTML – Computer language used to create Web pages CSS – Computer language used to describe the presentation of Web pages Colors Fonts New Perspectives on Microsoft Expression Web 3.05

Introducing Cascading Style Sheets Recognizing the Importance of CSS – Used to separate content from formatting – Greater consistency in your Web site – Easily modified code – More flexible formatting – Greater functionality – Does not have cross-browser support New Perspectives on Microsoft Expression Web 3.06

Understanding How Styles Are Written CSS Styles – Description of how to present Web page content – XHTML strong element renders text in bold CSS style for the strong element could set its color, font, size, etc. – Three parts: Selector – Identifies the element, class, or ID to which the style is being applied New Perspectives on Microsoft Expression Web 3.07

Understanding How Styles are Written Property – Specifies how the selector will be changed Value – Indicates the manner or extent to which the selector is modified h1{ color:blue; } New Perspectives on Microsoft Expression Web 3.08 All h1 text would appear in blue

Determining Where to Write Styles Style Sheet – A collection of styles Internal Style Sheet – HTML code and CSS code are in the same HTML file External Style Sheet – A separate file containing only the CSS code New Perspectives on Microsoft Expression Web 3.09

Determining Where to Write Styles Creating External Styles – Can format as many pages as desired – Preferred method for writing CSS code – CSS comment Precedes the style sheet code Provides documentation – author, date created or modified /* This is a CSS Comment */ New Perspectives on Microsoft Expression Web 3.010

Determining Where to Write Styles – Only CSS code is contained in a CSS external style sheet – Style sheet must be saved using the.css extension Filename cannot contain spaces Filename cannot begin with a number – HTML link element is used to attach a CSS style sheet to an HTML file Expression Web creates the tag code New Perspectives on Microsoft Expression Web 3.011

Determining Where to Write Styles Using Internal Styles – Written in the section of XHTML file – Referred to as embedded styles – Used only in document in which they are written – Expression Web creates most styles as internal styles using the start and end tags – Can be moved to an external style sheet when page is finalized New Perspectives on Microsoft Expression Web 3.012

Determining Where to Write Styles Using Inline Styles – Written within a tag in the section of XHTML document – Formats just a section of text – Similar to using direct formatting – Use sparingly Must be manually revised Cannot be named Cannot be moved from one document to another New Perspectives on Microsoft Expression Web 3.013

Determining Where to Write Styles New Perspectives on Microsoft Expression Web 3.014

Determining Where to Write Styles Creating Structure and Styles with the Common Toolbar – Not all icons on the Common toolbar create styles – Main purpose of the Common toolbar is to create structure on the Web page by creating HTML code Some HTML elements do create formatting along with structure New Perspectives on Microsoft Expression Web 3.015

Determining Where to Write Styles New Perspectives on Microsoft Expression Web 3.016

Determining Where to Write Styles – When a style is created, an icon will appear to the left of the style name in the Apply Styles panel New Perspectives on Microsoft Expression Web 3.017

Determining Where to Write Styles New Perspectives on Microsoft Expression Web – These panel icons are different colors and indicate what type of style is in use

Creating a Style Using an Element as a Selector Element Selectors – Format HTML elements such as p, h1, and em – Simplest of all HTML selectors – HTML elements have inherent characteristics Creating a style for inherent characteristics is not necessary, i.e., bold or a particular font size – Also known as type selectors New Perspectives on Microsoft Expression Web 3.019

Creating a Style Using an Element as a Selector Class Selectors – Used to select a specific HTML element or format one or more elements on a Web page ID Selectors – Used to uniquely format a single element on a Web page New Perspectives on Microsoft Expression Web 3.020

Using the Font Properties New Perspectives on Microsoft Expression Web Font Properties are used to change the appearance of text – CSS Font Properties: Font-family Font-size Font-style Font-weight Font-variant Font

Using the Font Properties Creating a Font Family – Font-family property Identifies font currently in use Expression Web has three predefined font families You can design your own font family Generic XHTML fonts: Serif, sans serif, monospace, cursive, fantasy New Perspectives on Microsoft Expression Web 3.022

Using the Font Properties New Perspectives on Microsoft Expression Web 3.023

Using the Font Properties Creating a Font Family – The font-family property identifies the current font being used – Expression Web has several pre-defined font families: serif sans-serif Fantasy Cursive monospace – You can create your own New Perspectives on Microsoft Expression Web 3.024

Using Font Properties New Perspectives on Microsoft Expression Web 3.025

Using Font Properties New Perspectives on Microsoft Expression Web 3.026

Using Font Properties Changing the Text Size – Can change text size without making the text a heading – Use just one h1 heading on a Web page Use it to format banner text or headline text only – Values for font size Keywords Percentages New Perspectives on Microsoft Expression Web 3.027

Using Font Properties Em values – Equal to default font size, usually 12 pt; 2em = 24 pt font New Perspectives on Microsoft Expression Web 3.028

Using Font Properties New Perspectives on Microsoft Expression Web Changing the Font Weight – Font-weight property makes text bold Common values are bold and normal (not bold) Keywords “lighter” and “bolder” are not generally supported Values ranging from 100 to 900 can also be used

Using Font Properties Making Text Italic – Use font-style property Italic – slants text Oblique – slants text more than italic; generally not supported Normal – removes italics from text that normally appears in italics New Perspectives on Microsoft Expression Web 3.030

Using Font Properties Working with Text Capitalization – Font-variant property Displays text in small caps but slightly smaller than normal text – Text-transform is a CSS text property Capitalize  None Lowercase  Inherit Uppercase New Perspectives on Microsoft Expression Web 3.031

Using Font Properties New Perspectives on Microsoft Expression Web 3.032

Using Font Properties Working with Color – Sets text (foreground) color – Part of the Font category – Choose from 16 Web safe colors or from colors on the Color Palette icon – Represented in HTML code by named color or hexadecimal value – Expression Web displays hexadecimal value only New Perspectives on Microsoft Expression Web 3.033

Using Font Properties Creating Text Decoration – Determines if a line should appear “over,” “under,” or “through” text – Values Underline (not recommended) Overline Line-through Blink (not recommended) None New Perspectives on Microsoft Expression Web 3.034

Using Font Properties New Perspectives on Microsoft Expression Web 3.035

Using Font Properties – Style ScreenTip Popup screen that reveals the style code View by hovering pointer over a style name in Apply Styles panel New Perspectives on Microsoft Expression Web 3.036

Visual Overview Creating CSS Reports New Perspectives on Microsoft Expression Web 3.037

Using Class Selectors Define the appearance of an element in multiple ways Dependent class – Styles only one element, ex., Element name Class name Independent Class – Styles any XHTML element – Does not use an element name New Perspectives on Microsoft Expression Web p.double.essential

Using Class Selectors Dependent ClassIndependent Class p.italic {.vital{ font-style: italic;color: red; }font-style: italic; p.double{} line-height: 2.0; font-weight: bold; } New Perspectives on Microsoft Expression Web ElementClass Name

Using Class Selectors Applying Classes – Two step process Create the class Apply the class where it you want it to appear in the document – Select desired text – In the Apply Styles or Manage Styles panel, right click the style – On shortcut menu, click Apply Style New Perspectives on Microsoft Expression Web 3.040

Using Class Selectors Creating an Independent Class Selector New Perspectives on Microsoft Expression Web 3.041

Using Class Selectors Creating an ID Selector – Very similar to independent classes – Styles any XHTML element – Styles the element only once on the Web page – Most often used with the XHTML element – User names the ID selector – Selector is preceded by a # # is a flag character; signals a special instruction New Perspectives on Microsoft Expression Web 3.042

Using Class Selectors Modifying and Applying an Existing Style – In Apply Styles panel, right click desired style – Click Modify style – Make desired changes – Click OK – Save the file New Perspectives on Microsoft Expression Web 3.043

Using External Styles External Styles – Are the most powerful of all styles – Format multiple documents at the same time – Separate format from content – Contain only CSS code – Begin each external style sheet with a CSS comment: – Attach style sheet to Web page New Perspectives on Microsoft Expression Web /* External Style Sheet created by [name] */

Using External Styles Detaching and Attaching an External Style Sheet – Open desired Web page – Use the Apply Styles or Manage Styles panel to open the Attach Style Sheet dialog box Options for Attach to – All HTML pages – Selected pages – Current page New Perspectives on Microsoft Expression Web 3.045

Using External Styles Options for Attach – Link option enters code for the tag in the section of the Web page – Import option inserts import code instead of link code New Perspectives on Microsoft Expression Web 3.046

Managing Styles New Perspectives on Microsoft Expression Web Can customize how to view and group styles Apply Styles panel – Previews background color – Automatically previews the appearance of styles Manage Styles panel – Categorizes styles by element

Managing Styles New Perspectives on Microsoft Expression Web 3.048

Managing Styles Running CSS Reports – CSS Reports feature checks for errors in CSS code in Web pages and external style sheets – CSS Reports feature will also find Unused styles Undefined classes Mismatched cases New Perspectives on Microsoft Expression Web 3.049

Managing Styles New Perspectives on Microsoft Expression Web 3.050