Tutorial 3 Designing a Web Page 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

Building a Website: Cascading Style Sheets (CSS) Fall 2013.
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} //
Session Objectives Setting the font family Setting the font size Working with Web fonts Setting font faces and sizes Setting font and text appearances.
Session Objectives What is CSS? Define CSS syntax Learn about the authoring options Add comments to a CSS Defining color in CSS.
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 4 Formatting Text. XP New Perspectives on Blended HTML, XHTML, and CSS2 Objectives Create a spread heading Indent text Change the line spacing.
Week 7 Web Typography. 2 Understanding Type Design Principles.
INTRODUCTORY Tutorial 3 Using CSS to Format Multiple Pages.
Tutorial 3 Working with Cascading Style Sheets. XP Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external.
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.
Tutorial 4 Creating Special Effects with CSS
Cascading style sheets - CSS
Working with Cascading Style Sheets. 2 Objectives Introducing Cascading Style Sheets Using Inline Styles Using Embedded Styles Using an External Style.
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,
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
Using Cascading Style Sheets. Introduction to Styles and Properties  Cascading Style Sheets (CSS) are a standard set by the World Wide Web Consortium.
XP Tutorial 7New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks.
Cascading style sheets (CSS)
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, pt 2 ECA 225 Applied Online Programming.
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
WDV 101 Intro to Website Development
Tutorial 3 Working with Cascading Style Sheets (CSS)
(CSS) More Details Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorials 3 & 4: Working With CSS.
Tutorial #4 Formatting Text and Links. Tutorial #3 Review - CSS CSS format Selector { property1: value1; /* Comments */ } Embedded, In-Line, and External.
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.
MySQL and PHP Review CSS. Cascading Style Sheet (CSS) Style sheets are files or forms that describe the layout and appearance of a document. Cascading.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Tutorial 7.
INTRODUCTORY Tutorial 4 Exploring Graphic Elements and Images.
Cascading Style Sheets Robin Burke ECT 270. Outline Midterm The Layout Debate CSS properties Fonts Alignment Color CSS selection selectors pseudo-classes.
1 Cascading Style Sheet (CSS). 2 Cascading Style Sheets (CSS)  a style defines the appearance of a document element. o E.g., font size, font color etc…
INTRODUCTORY Tutorial 3 Using CSS to Format Multiple Pages.
3. Cascading Style Sheets (CSS) M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer.
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.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
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,
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 7: CSS Building Blocks.
CNIT 132 – Week 4 Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of.
©SoftMoore ConsultingSlide 1 Introduction to HTML: Cascading Style Sheets.
CSS properties Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.
CSS: Cascading Style Sheets Part II. Style Syntax.
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.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 4 Formatting Text and Links.
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 10: Formatting Text with Styles.
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.
Objectives Explore the history of CSS
CSS Style Sheets: Intro
Cascading Style Sheets Color and Font Properties
Tutorial 3 Working with Cascading Style Sheets
Presentation transcript:

Tutorial 3 Designing a Web Page with CSS

Objectives Explore the history and theory of CSS Define a style rule Study style precedence and inheritance Apply color using CSS Explore CSS3 color extensions Use contextual selectors New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Objectives Work with attribute selectors Apply text and font styles Install a Web font Define list styles Use pseudo-classes and pseudo-elements Create a rollover effect New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Style Sheets and Color New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Introducing CSS To render a document, the device displaying the page needs a style sheet that specifies the appearance of each page element The style sheet language used on the Web is the Cascading Style Sheets language, also known as CSS Versions include CSS1, CSS2, CSS 2.1, and CSS3 With CSS, as with HTML, Web page designers need to be aware of compatibility issues that arise not just among different versions of the language, but also among different versions of the same browser New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Defining a Style Rule The general syntax of a CSS style rule is selector { property1: value1; property2: value2; property3: value3; ... } New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Applying a Style Sheet The design you apply to a Web site is usually a combination of several style sheets New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

User-Defined Styles Almost all browsers allow users to modify the default settings of the internal style sheet New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

External Style Sheets New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Embedded Style Sheets Another type of style sheet created by a Web page author is an embedded style sheet, in which the styles are inserted directly within the head element of an HTML document using the style element <style type=”text/css”> styles </style> The exact order in which external style sheets and embedded style sheets are processed by the browser depends on the order in which they are listed within the HTML file New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Inline Styles The very last styles to be interpreted by the browser are inline styles, which are styles applied directly to specific elements using the style attribute <element style=”style rules”> … </element> It is clear exactly what page element is being formatted Not recommended in most cases and considered inefficient New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Exploring the Style Cascade As a general rule of thumb, all other things being equal, the more specific style is applied instead of the more general An additional factor in applying a style sheet is that properties are passed from a parent element to its children in a process known as style inheritance body {color: blue;} h1 {text-align: center;} New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Exploring the Style Cascade If you need browsers to enforce a style, you can append the !important keyword to the style property, using the syntax property: value !important; The !important keyword is often necessary for visually impaired users who require their pages rendered with large, clear text and highly contrasting colors New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Writing Style Comments New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Defining Color in CSS A color value is a numerical expression that describes the properties of a color CSS represents these intensities mathematically as a set of numbers called an RGB triplet, which has the format rgb(red, green, blue) CSS also allows RGB values to be entered as hexadecimal numbers #redgreenblue New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Defining Color in CSS New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Setting Foreground and Background Color To set the background color of an element, use the property background-color: color; where color is a color name or a color value. To set the foreground or text color of an element, use the following property: color: color; New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Enhancements to Color in CSS3 CSS3 also supports the Hue Saturation Lightness (HSL) model that describes colors based on hue, saturation, and lightness hsl(hue, saturation, lightness) New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Enhancements to Color in CSS3 New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Enhancements to Color in CSS3 CSS3 also allows page designers to augment RGB and HSL color values by specifying a color’s opacity. Opacity defines how much of the colors below the surface of the current object show through to affect its appearance rgba(red, green, blue, opacity) hsla(hue, saturation, lightness, opacity) New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Enhancements to Color in CSS3 New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Selectors and Text Styles New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Contextual Selectors Web pages are structured documents in which elements are nested within other elements, forming a hierarchy of elements To create styles that take advantage of this tree structure, CSS allows you to create contextual selectors whose values represent the locations of elements within the hierarchy Parent elements Child elements Sibling elements Descendant elements New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Contextual Selectors New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Attribute Selectors Selectors also can be defined based on attributes and attribute values associated with elements Two attributes, id and class, are often key in targeting styles to a specific element or group of elements New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Attribute Selectors New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Styling Web Page Text The default font used by most browsers is Times New Roman, but you can specify a different font for any page element using the property font-family: fonts; fonts is a comma-separated list of specific or generic font names New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Styling Web Page Text New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Setting Font Face and Sizes To define a font face, use the style property font-family: fonts; where fonts is a comma-separated list of fonts that the browser can use with the element. List specific fonts first and complete the list with a generic font. To set a font size, use the style property font-size: size; where size is a CSS unit of length in either relative or absolute units. New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Setting Font Face and Sizes To set kerning (the space between letters), use the following style property: letter-spacing: size; To set tracking (the space between words), use the following style property: word-spacing: size; New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Setting the Line Height New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Setting Font and Text Appearance To specify the font style, use font-style: type; where type is normal, italic, or oblique. To specify the font weight, use font-weight: type; where type is normal, bold, bolder, light, lighter, or a font weight value. New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Setting Font and Text Appearance To specify a text decoration, use text-decoration: type; where type is none, underline, overline, or line-through. To transform text, use text-transform: type; where type is capitalize, uppercase, lowercase, or none. To display a font variant of text, use font-variant: type; where type is normal or small-caps. New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Aligning Text Vertically New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Combining All Text Formatting in a Single Style You can combine most of the text and font styles into a single property using the shortcut font property font: font-style font-variant font-weight font-size/line-height font-family; New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Combining All Text Formatting in a Single Style New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Working with Web Fonts New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Understanding the CSS @rules New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Lists and Pseudo-Items New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Designing Styles for Lists To change the marker displayed in ordered or unordered lists, you apply the style list-style-type: type; New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Designing a List To define the appearance of the list marker, use the style list-style-type: type; where type is disc, circle, square, decimal, decimal-leading-zero, lower-roman, upper-roman, lower-alpha, upper-alpha, lower-greek, upper-greek, or none. To insert a graphic image as a list marker, use the style list-style-image: url(url); where url is the URL of the graphic image file. New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Designing a List To set the position of list markers, use the style list-style-position: position; where position is inside or outside. To define all of the list style properties in a single style, use the following style: list-style: type url(url) position; To set the indentation of a list, apply the style padding-left: size; where size is the length that the list should be indented. New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Using Pseudo-Classes and Pseudo-Elements A pseudo-class is a classification of an element based on its current status, position, or use in the document selector:pseudo-class {styles;} New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Using Pseudo-Classes and Pseudo-Elements New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition

Pseudo-Elements New Perspectives on HTML, CSS, and Dynamic HTML 5th Edition