1 Introduction to Web Application Introduction to Cascading Style Sheet.

Slides:



Advertisements
Similar presentations
1 Cascading Style Sheets™ (CSS) Outline 5.1 Introduction 5.2 Inline Styles 5.3 Embedded Style Sheets 5.4 Conflicting Styles 5.5 Linking External Style.
Advertisements

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.
 2002 Prentice Hall, Inc. All rights reserved. Chapter 4 – Cascading Style Sheets (CSS) Objectives –To take control of the appearance of a Web site by.
1 Dynamic HTML: Cascading Style Sheets™ (CSS). 2 Introduction Cascading Style Sheets (CSS) –Specify the style of your page elements –Spacing, margins,
1 XHTML Cascading Style Sheets™ (CSS). 2 Inline.html 1 2
Working with Cascading Style Sheets
 2003 Prentice Hall, Inc. All rights reserved. Chapter 6 - Cascading Style Sheets™ (CSS) Outline 6.1 Introduction 6.2 Inline Styles 6.3 Embedded Style.
 2002 Prentice Hall, Inc. All rights reserved. Chapter 4 – Cascading Style Sheets (CSS) Outline 4.1Introduction 4.2Inline Styles 4.3Creating Style Sheets.
CASCADING STYLE SHEETS CSS. 2 What CSS means?  CSS is an extension to basic HTML that allows you to style your web pages.  It separates the part that.
Text Properties, Line Box, CSS. Text Properties Properties related to the display of text. Text-align : left, right, center I like FSU!
Cascading Style Sheets Cyndi Hageman. Applying a Style Sheet  In-line style – used within the HTML tag  Embedded Style Sheet – located in the HTML document.
CSE CASCADING STYLE SHEETS CSS Faculty of Computer Science and Engineering.
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.
1 Dynamic HTML -Cascading Style Sheets™ (CSS) Outline 6.1 Introduction 6.2 Inline Styles 6.3 Embedded Style Sheets 6.4 Conflicting Styles 6.5 Linking External.
Lecture CSS: Cascading Style Sheets. What are Styles? Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation semantics.
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
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 CS3505. What are CSS? Method for adding style attributes consistently to HML tags Cascading because styles are applied in order.
Cascading Style Sheets Billy Toy Cascading Style Sheets Syntax review How to Implement style sheets Background properties Text properties.
 2000 Deitel & Associates, Inc. All rights reserved. Chapter 14 – Dynamic HTML: Cascading Style Sheets (CSS) Outline 14.1Introduction 14.2Inline Styles.
CSS Dvijesh Bhatt.
Dreamweaver -- CSS. Dreamweaver -- MX New icons are added in MX Most of the features commonly used in web design, and are same as FrontPage. New feature.
Cascading Style Sheets, pt 2 ECA 225 Applied Online Programming.
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
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.
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorials 3 & 4: Working With CSS.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 6 - Cascading Style Sheets™ (CSS) Outline 6.1 Introduction 6.2 Inline Styles 6.3 Embedded Style.
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.
Cascading Style Sheet Bayu Priyambadha, S.Kom. Definition Cascading Style Sheets (CSS) form the presentation layer of the user interface. –Structure (HTML)
CHAPTER 3 CSS & CSS3 อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
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.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 6 - Cascading Style Sheets™ (CSS) Outline 6.1 Introduction 6.2 Inline Styles 6.3 Embedded Style.
Lesson 03 // Cascading Style Sheets. CSS Stands for Cascading Style Sheets. We’ll be using a combination of Html and CSS to create websites. CSS is a.
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
 2004 Prentice Hall, Inc. All rights reserved. Chapter 6 - Cascading Style Sheets™ (CSS) Outline 6.1 Introduction 6.2 Inline Styles 6.3 Embedded Style.
 Cascading Style Sheets (CSS) ◦ Used to specify the presentation of elements separately from the structure of the document.  Inline style ◦ declare.
CHAPTER 2 CSS (Cascading Style Sheet). Topics Introduction Inline Styles Embedded Style Sheets Conflicting Styles Linking External Style Sheets Positioning.
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
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.
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
3.2 Cascading Style Sheets. 2 Positioning Elements Normally, elements are laid out on the page in the order that they are defined in the XHTML document.
©SoftMoore ConsultingSlide 1 Introduction to HTML: Cascading Style Sheets.
CSS – Cascading Style Sheets
Cascading Style Sheets Web Design Fairport High School.
5 th ed: Chapter 4 4 th ed: Chapter 5 SY306 Web and Databases for Cyber Operations Slide Set #4: CSS.
CSS properties Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.
CSS: Cascading Style Sheets Part II. Style Syntax.
Web Technology (NCS-504) Prepared By Mr. Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad.
ECA 228 Internet/Intranet Design I Cascading Style Sheets.
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
Tutorial #5 Working with the Box Model. Tutorial #4 Review - CSS Create a homework page Final Project Discussion Exam on Blackboard Styling Lists (List-style-type,
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
Chapter 11 & 12 CSS Style Sheets: Intro. Why CSS? Separate presentation from content – more accessible Less work – can change appearance of whole site.
CS 120: Introduction to Web Programming Lecture 10: Extra Features and Website Design Part 1 Tarik Booker CS 120 California State University, Los Angeles.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
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)
Welcome To Website Design, Hosting And Management Prepared By Webdev Solution ip ,223,96.
HTML & CSS Contents: the different ways we can use to apply CSS to The HTML documents CSS Colors and Background CSS Fonts CSS Text CSS box model: padding,
Unit 3 - Review. Topics 1. Tag, Attribute, Value 2. CSS Rule Syntax + link 3. Categories of Selectors 4. Inline vs Block Tags 5. CSS Layout 6. CSS Box.
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
Chapter 6 - Cascading Style Sheets™ (CSS)
Cascading Style Sheets™ (CSS)
Cascading Style Sheets™ (CSS)
Presentation transcript:

1 Introduction to Web Application Introduction to Cascading Style Sheet

2 Topics Introduction Inline Styles Embedded Style Sheets Conflicting Styles Linking External Style Sheets Positioning Elements Element Dimensions Text Flow and the Box Model User Style Sheets

3 Objectives In this lesson, you will learn: –To control the appearance of a Web site by creating style sheets. –To use a style sheet to give all the pages of a Web site the same look and feel. –To use the class attribute to apply styles. –To specify the precise font, size, color and other properties of displayed text. –To specify element backgrounds and colors. –To understand the box model and how to control the margins, borders and padding. –To use style sheets to separate presentation from content.

4 Introduction Cascading Style Sheets (CSS) –Separation of structure from presentation Relationship with HTML

5 Different between HTML tags and CSS Hello

6 Ways to Change HTML Default Presentation Presentation Elements or Properties –Font, bgcolor, etc. Using some Elements to control the page layout –Table, img, etc. Cascading style Sheets (CSS) !!

7 Why CSS? HTML is primarily concerned with content, rather than style Power, Flexibility, Rendering, Accessibility … dreamweaver/articles/why_css.html

8 Evolution of CSS 1996 W3C Bert Bos&Hakon Lie CSS Level CSS CSS Mobile Profile Now CSS2.1 CSS3

9 CSS Grammar p {font-size: 12pt; font-style: italic; color: green} Selector Property list separated by semicolons PropertyProperty value Colon

10 Relative units: –emheight of letter m –enheight of letter n –exheight of letter x –pxpixels –%percent Units

11 Units Absolute units: –ininch –cmcentimeter –mmmillimeter –ptpoint(1pt=1/72inch) –pc12points(1pc=12pt)

12 Inline Styles Declare an individual element’s format –Attribute style –CSS property Followed by a colon and a value –Example: hello world

13

14 Embedded Style Sheets Embed an entire CSS document in an XHTML document’s head section –Multipurpose Internet Mail Extensions (MIME) type Describes a file’s content –Property background-color Specifies the background color –Property font-family Specifies the name of the font to use –Property font-size Specifies a 14-point font

15 Example of Embedded CSS p{font-size: 14 pt; color:red}.special{color: blue} Hello World! School of Software

16

17 Conflicting Styles Inheritance –Descendant’s properties have greater specificity than ancestor’s properties

18 Example of Conflicting Styles li em {color: red; font-weight: bold} ul{margine-left:75pt} ul ul{text-decoration: underline; margine-left:15pt} Milk White bread Pizza with mushrooms

19

20 Example of Conflicting Styles (cont.) a.nodec{text-decoration: none; font-size: 18pt} a:hover{text-decoration: underline; color: red; background-color: #ccffcc; } hello world none overline line-through underline blink none overline line-through underline blink

21

22 Linking External Style Sheets External style sheets –Can provide uniform look and feel to entire site Example:

23 Content of styles.css /* An external stylesheet */ a { text-decoration: none } a:hover { text-decoration: underline; color: red; background-color: #ccffcc } li em { color: red; font-weight: bold; background-color: #ffffff } ul { margin-left: 2cm } ul ul { text-decoration: underline; margin-left:.5cm }

24 Positioning Elements Absolute positioning –z-index attribute Layer overlapping elements properly Relative positioning –Elements are positioned relative to other elements

25 Example of Position Absolute Positioning <img src = "i.gif" style = "position: absolute; top: 0px; left: 0px; z-index: 1" alt = "First positioned image" /> <p style = "position: absolute; top: 50px; left: 50px; z-index: 3; font-size: 20pt">Positioned Text <img src = "circle.gif" style = "position: absolute; top: 25px; left: 100px; z-index: 2" alt = "Second positioned image" />

26

27 Example of Position (cont.) Relative Positioning p { font-size: 1.3em; font-family: verdana, arial, sans-serif } span { color: red; font-size:.6em; height: 1em }.super { position: relative; top: -1ex }.sub { position: relative; bottom: -1ex }.shiftleft { position: relative; left: -1ex }.shiftright { position: relative; right: -1ex }

28 The text at the end of this sentence is in superscript. The text at the end of this sentence is in subscript. The text at the end of this sentence is shifted left. The text at the end of this sentence is shifted right.

29 is in superscript is in subscript. is shifted left is shifted right.

30 Backgrounds background-image –Specifies the image URL background-position –Places the image on the page background-repeat –Controls the tiling of the background image background-attachment –fixed –scroll font-weight –Specify the “boldness” of text

31 Example of Backgrounds Background Images body { background-image: url(logo.gif); background-position: bottom right; background-repeat: no-repeat; background-attachment: fixed; } p { font-size: 18pt; color: #aa5588; text-indent: 1em; font-family: arial, sans-serif; }.dark { font-weight: bold }

32 This example uses the background-image, background-position and background-attachment styles to place the Deitel & Associates, Inc. logo in the bottom, right corner of the page. Notice how the logo stays in the proper position when you resize the browser window.

33

34 Element Dimensions CSS rules can specify the actual dimensions of each page element

35 Example of Element Dimension P 158 Box Dimensions div { background-color: #ffccff; margin-bottom:.5em }

36

37 Text Flow and the Box Model Floating –Move an element to one side of the screen

38 Text flow p160 Flowing Text Around Floating Elements div { background-color: #ffccff; margin-bottom:.5em; font-size: 1.5em; width: 50% } p { text-align: justify }

39

40 Text Flow and the Box Model Box model –Margins margin-top, margin-right, margin-left, margin-bottom –Padding padding-top, padding-right, padding-left, and padding-bottom –Border border-width –thin, medium, thick border-color –Sets the color border-style –none, hidden, dotted, dashed, solid, double, groove, ridge, inset and outset

41 Text Flow and the Box Model Fig. 6.13Box model for block-level elements.

42

43

44 User Style Sheets Format pages based on preferences User style sheets are not linked to a document; Rather, they are set in the browser’s options

45 References

46 Boxes and Layout border –border Group property, the same below –border-color –border-width –border-style –exampleexample

47 Boxes and Layout margin –margin-top, margin-bottom, margin-right, margin-left –exampleexample padding –padding-top, padding-bottom, padding-right, padding-left –exampleexample

48 Fonts and Texts Fonts –font: Group property –font-family Sets or retrieves the name of the font used for text in the object –font-size Sets or retrieves a value that indicates the font size used for text in the object –font-style Sets or retrieves the font style of the object as italic, normal, or oblique

49 Fonts and Texts Fonts –font-variant Sets or retrieves the font style of the object as italic, normal, or oblique –font-weight Sets or retrieves the weight of the font of the object –exampleexample

50 Fonts and Texts Generic Fonts: –serifTimes New Roman –sans-serifArial –cursiveScript –fantasyComic –monospaceCourier New –exampleexample

51 Fonts and Texts Texts: –letter-spacing Sets or retrieves the amount of additional space between letters in the object –word-spacing Sets or retrieves the amount of additional space between words in the object –white-space Sets or retrieves a value that indicates whether lines are automatically broken inside the object

52 Fonts and Texts Texts: –line-height Sets or retrieves the distance between lines in the object –text-align Sets or retrieves whether the text in the object is left- aligned, right-aligned, centered, or justified –vertical-align Sets or retrieves the vertical alignment of the object

53 Fonts and Texts Texts –text-decoration Sets or retrieves a value that indicates whether the text in the object has blink, line-through, overline, or underline decorations –text-indent Sets or retrieves the indentation of the first line of text in the object

54 Fonts and Texts Texts –text-transform Sets or retrieves the rendering of the text in the object –exampleexample

55 Lists –list-style Sets or retrieves up to three separate listStyle properties of the object –list-style-image Sets or retrieves up to three separate listStyle properties of the object

56 Lists –list-style-position Sets or retrieves a variable that indicates how the list-item marker is drawn relative to the content of the object. –list-style-type Sets or retrieves a variable that indicates how the list-item marker is drawn relative to the content of the object. –exampleexample

57 Hypertext –a:link Sets the style of an a element when the link has not been visited recently. –a:visited Sets the style of an a element when the link has been visited recently –a:active Sets the style of an a element when the link is engaged or active –exampleexample

58 Position Absolute position –position=absolute –exampleexample Relative position –position=relative –exampleexample

59 Position Layer –z-index Sets or retrieves the stacking order of positioned objects top, bottom, left, right other examplesexamples

60 Position Floating –floating –exampleexample

61 Filters Filters: – 翻转 : flipv fliph exampleexample – 透明 : chroma exampleexample – 反转 : invert – 灰度 : gray –x 光 : xray exampleexample – 阴影 : shadow exampleexample – 发光 : glow exampleexample – 渐变 : alpha exampleexample

62 Filters Filters: – 模糊 : blur exampleexample – 弦波 : wave exampleexample –… exampleexample

63 Filters Transition –Transition event happens when visibility property value change from hidden to visible –example1example1 –example2example2

64 Web Resources