Chapter 3 CSS. Vacabulary CSS: 层叠样式表 Syntax: 语法 Selector: 选择器 filter :滤镜 / 过滤器 background: 背景 property: 属性.

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

CSS Cascading Style Sheets. Contents{ 1. What is CSS? 1. A Brief History of CSS 2. Why to use Styles? 2. Syntax 3. Cascading Order 4. Examples of Properties.
Web Engineering 1 Ishaq Khan Shinwari MCS City University Peshawar.
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.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
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.
CSS normally control the html elements. Three Ways to Insert CSS There are three ways of inserting a style sheet: External style sheet Internal style.
Introduction to Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 4.
Prepared by ackoo Styli n g your page (font type, font size, colors, text decoration, alignment, set margin, table padding, etc.) References: W3Schools.
Web Workshop: CSS Objectives: - “What is CSS?” - Structure of CSS - How to use CSS in your webpage.
1 Creating Web Pages Part 3. 2 CASCADING STYLE SHEETS (CSS): What exactly are they? Set of rules that define how a web browser should display an HTML.
1 Cascading Style Sheets C S S. 2 What is CSS? A simple mechanism for controlling the style of a Web document without compromising its structure. It allows.
Using Cascading Style Sheets CSS Structure. Goals Understand how contextual, class and ID selectors work Understand how contextual, class and ID selectors.
Cascading Style Sheet (CSS) Instructor: Dr. Fang (Daisy) Tang
4.01 Cascading Style Sheets
Computing Concepts: CSS. Aims  To understand the uses of css  To understand the different types of css  To be able to create a css file  To be able.
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.
Using Cascading Style Sheets (CSS) Dept. of Computer Science and Computer Information CSCI N-100.
Using Cascading Style Sheets. Introduction to Styles and Properties  Cascading Style Sheets (CSS) are a standard set by the World Wide Web Consortium.
Cascading Style Sheets Example
CSS Dvijesh Bhatt.
HTML/CSS Hyper Text Markup Language. CSS Cascading Style Sheets.
Cascading style sheets (CSS)
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
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
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
1 What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles are normally stored in Style Sheets  Styles.
ITCS373: Internet Technology Week 3: Introduction to CSS Dr. Faisal Al-Qaed.
CSS My favourite ICT lesson By Federico Boschi Cascading Style Sheets.
Just A Few More Fun Objectives 1 Having Some Fun With Java Script 2 Using Style Sheets.
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.
CO1552 – Web Application Development Cascading Style Sheets.
INTRODUCTION TO CSS. OBJECTIVES: D EFINE WHAT CSS IS. K NOW THE HISTORY OF CSS. K NOW THE REASON WHY CSS IS USED. CSS SYNTAX. CSS ID AND CLASS.
Tutorial #3 Cascading Style Sheets. Tutorial #2 Review - Anchors Links to Site DMACC Internal Links Go to Top Mail To me Local.
Cascading Style Sheets in.NET Lilian Kiilu, Client/Server & Web Applications, Coms 463/563, Section 1pm, Fall 2005, November 16 th 2005.
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
Cascade Style Sheet Introduction. What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles were added.
IS1825: Developing Multimedia Applications for Business Lecture 1: Introduction to CSS Rob Gleasure
Stylin’ with CSS Monday October 8 th and Tuesday October 9 th.
Web Design and Development for Business Lecture 4 Cascading Style Sheet (CSS)
CSS Tutorial 1 Introduction Syntax How to use style specifications. Styles.
CSS – Cascading Style Sheets
5 th ed: Chapter 4 4 th ed: Chapter 5 SY306 Web and Databases for Cyber Operations Slide Set #4: CSS.
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
Designing Web Pages The case for CSS. The Power of CSS css Zen Garden
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
How to… Cascading Style Sheets. How to Insert a Style Sheet When a browser reads a style sheet, it will format the document according to it. There are.
CSS Syntax. Syntax The CSS syntax is made up of three parts: a selector, a property and a value: selector {property: value}
Cascading Style Sheets (CSS)
Basic Webpage Design Cascading Style Sheet (CSS).
Tutorial 3 Designing a Web Page with CSS
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.
1 CS428 Web Engineering Lecture 07 Font, Text & Background (CSS - II)
CSS DHS Web Design. Location Between the & Start with – End with –
Cascading Style Sheets Using HTML. What are they? A set of style rules that tell the web browser how to present a web page or document. In earlier versions.
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.
1 Cascading Style Sheets
WEB FOUNDATIONS CSS Overview. Outline  What is CSS  What does it do  Where are styles stored  Why use them  What is the cascade effect  CSS Syntax.
CSS.
CSS Cascading Style Sheets
Cascading Style Sheet (CSS)
What are Cascading Stylesheets (CSS)?
Tutorial 3 Working with Cascading Style Sheets
Presentation transcript:

Chapter 3 CSS

Vacabulary CSS: 层叠样式表 Syntax: 语法 Selector: 选择器 filter :滤镜 / 过滤器 background: 背景 property: 属性

Outline 1. What is CSS? 2. A Brief History of CSS 3. Why to use Styles? 4. Syntax 5. Cascading Order 6. Examples of Properties 7. Limitations 8. CSS variations

What is CSS? CSS stands for Cascading Style Sheets Styles define how to display (X)HTML elements Styles are normally stored in Style Sheets Multiple style definitions will cascade into one

A Brief History of CSS Style sheets have existed since the beginnings of SGML in the 1970s As HTML grew, it came to encompass a wider variety of stylistic capabilities Nine different style sheet languages were proposed to the W3C Two were chosen as the foundation for CSS: CHSS and Stream-based Style Sheet Proposal CSS level 1 – 1996; CSS level 2 – 1997 Difficulties with adoption

Why to use Styles? Documents written with CSS are –more flexible –short –clear Basic formating tool Easy multiple document managment Save time by using selector classes New opportunities in formating WebpageStructure(X)HTML Style- formatting CSS

Basic Syntax Made up of three parts: selector {property: value} The selector is normally the HTML element/tag you wish to define The property is the attribute you wish to change Every property has the value

Syntax If the value is multiple words, put quotes around the value p {font-family: "sans serif"} To make the style definitions more readable, you can describe one property on each line p{ text-align: center; text-align: center; color: black; color: black; font-family: arial font-family: arial}

Grouping h1,h2,h3,h4,h5,h6{ color: green } All header elements will be displayed in green text color This is header h1 This is header h2 This is header h3 This is header h4

The class Selector With the class selector you can define different styles for the same type of HTML element. p.right {text-align: right} p.center {text-align: center} Using the class argument in (X)HTML: This paragraph will be right-aligned. This paragraph will be right-aligned. This paragraph will be center-aligned. This paragraph will be center-aligned.

Text color <html><head> h1 {color: green} h2 {color: #dda0dd} h2 {color: #dda0dd} p {color: rgb(0,0,255)} p {color: rgb(0,0,255)}</style></head><body> This is header 1 This is header 1 This is header 2 This is header 2 This is a paragraph This is a paragraph </body></html> This is header 1 This is header 2 This is a paragraph

Inserting Style sheet

Cascading order 1. Browser default 2. External style sheet  inside external *.css file 3. Internal style sheet  inside the tag 4. Inline style  inside an HTML element

External Style Sheet Each webpage must link to the style sheet using the tag Browser reads styles definitions from mystyle.css file <head> </head>

Internal Style Sheet Internal Style Sheet Should be used when a single document has a unique style Defined in the head section by using the tag <head> hr {color: sienna} p {margin-left: 20px} body {background-image: url("images/back40.gi f")} </style></head>

Multiple Style Sheets An internal style sheet has following properties for the h3 selector: h3 { text-align: right; font-size: 20pt } External style sheet has these: h3 { color: red; text-align: left; font-size: 8pt } Your Web Browser has default formatting: h3 { color: black; font size: 10pt } What will be the format of tag? o color: red; o text-align: right; o font-size: 20pt

Examples

Background: Control over the background color of an element set an image as the background, repeat a background image background-color –color-rgb color-hex color-name background-image –url(URL) none background-repeat –repeat repeat-x repeat-y no-repeat

Text:colordirection –ltr rtl word spacing –normal length text-decoration –none underline overline line-through blink text-align –left right center justify

Font: font-family family-name generic-family family-name generic-familyfont-size –xx-small x-small small –/etc./ font-weigh –normal bold bolder lighter 100

Dimension

List: <head> ul{ list-style-image: url('arrow.gif') }</style></head><body><ul> Coffee Coffee Tea Tea Coca Cola Coca Cola </ul></body>

CSS Limitations Some noted disadvantages of using "pure" CSS include –Inconsistent browser support –Inconsistent browser support –Absence of expressions –Absence of expressions –Lack of Variables –Lack of Variables –Lack of multiple backgrounds per element –Lack of multiple backgrounds per element –Control of Element Shapes –Control of Element Shapes

CSS level 1 The first CSS specification to become an official W3C Recommendation is CSS level 1, published in December Among its capabilities are support for: –Font properties such as typeface and emphasis –Color of text, backgrounds, and other elements –Text attributes such as spacing between words, letters, and lines of text –Alignment of text, images, tables and other elements –Margin, border, padding, and positioning for most elements –Unique identification and generic classification of groups of attributes The W3C maintains the CSS1 Recommendation.

CSS level 2 published as a Recommendation in May includes a number of new capabilities –absolute, relative, and fixed positioning of elements –the concept of media types –bidirectional text –new font properties such as shadows The W3C maintains the CSS2 Recommendation. CSS level 2 revision 1 or CSS 2.1 fixes errors in CSS2 –returned to Candidate Recommendation status on 19 July 2007