Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.

Slides:



Advertisements
Similar presentations
HIGH LEVEL OVERVIEW: CSS CSS SYNTAX CONSISTS OF A SET OF RULES THAT HAVE 3 PARTS: A SELECTOR, A PROPERTY, AND A VALUE. IT’S NOT NECESSARY TO REMEMBER THIS.
Advertisements

CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Web Pages Week 10 This week: CSS Next week: CSS – Part 2.
Cascading Style Sheets
Cascading Style Sheets
Today CSS HTML A project.
CSS CSS Precise Aesthetic Control. Cascading Style Sheets Though they can be put in HTML header, usually a separate page that the HTML links to Contains.
Chapter 3 – Designing your web pages Dr. Stephanos Mavromoustakos.
Introduction to CSS. What is CSS? A CSS (cascading style sheet) file allows you to separate your web sites (X)HTML content from it’s style. Use your (X)HTML.
HTML – A Brief introduction Title of page This is my first homepage. This text is bold  The first tag in your HTML document is. This tag tells your browser.
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.
CSS BASICS. CSS Rules Components of a CSS Rule  Selector: Part of the rule that targets an element to be styled  Declaration: Two or more parts: a.
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
1 Dreamweaver CS5 intermediate class by Cookie Setton Build a CSS website WITHOUT TABLES Just when you thought you were starting to understand HTML coding,
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
กระบวนวิชา 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.
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.
Beginning Web Site Creation: Dreamweaver CS4. XHTMLCSS  Describes the structure  Content  Collection of styles  Formatting body { background-color:
Lecture Cascading Style Sheets (CSS) Internal Style Sheets Classes.
Web Workshop: CSS Objectives: - “What is CSS?” - Structure of CSS - How to use CSS in your webpage.
4.01 Cascading Style Sheets
CSS (Cascading Style Sheets): How the web is styled Create Rules that specify how the content of an HTML Element should appear. CSS controls how your web.
Cascading Style Sheets Dreamweaver. Styles Determine how the HTML code will display Determine how the HTML code will display Gives designers much more.
CSS Style Rules Guang Tong, Zhan L;lo’p[ Css Style Rule Guang Tong Zhan Three ways to insert CSS 1 External style sheet 2 Internal style sheet 3 Inline.
HTML - Quiz #2 Attendance CODE:
Cascading style sheets (CSS)
The Characteristics of CSS
Today’s objectives  Presentational | Inline | Block | Validate  CSS | Rules | Declarations.
CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.
MCS 270 Cascading Style Sheets (CSS) Gustavus Adolphus College.
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.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Cascading Style Sheets Orientation Learning Web Design: Chapter 11.
CO1552 – Web Application Development Cascading Style Sheets.
CSS CSS is short for C ascading S tyle S heets. It is a new web page layout method that has been added to HTML to give web developers more control over.
The Web Wizard’s Guide To DHTML and CSS Chapter 1 A Review of CSS1.
Introduction to Programming the WWW I CMSC Winter 2003 Lecture 7.
Cascade Style Sheet Introduction. What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles were added.
Cascading Style Sheets Dreamweaver. Styles Determine how the HTML code will display Determine how the HTML code will display Gives designers much more.
CSS Cascading Style Sheets. CSS Advantages Greater typography and page layout control Style is separate from structure Styles can be stored in a separate.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Tutorial 7.
HTML - Quiz #2 Attendance CODE:
Course created by Sarah Phillips BBCD Melbourne BAPDCOM Version 1 – April 2013.
Cascading Style Sheets Level 2. Course Objectives, Session 1 Level 1 Quick Review Chapter 8: Adding Graphics to Web Pages Chapter 9: Sprucing Up Your.
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
Cascading Style Sheets (CSS). A style sheet is a document which describes the presentation semantics of a document written in a mark-up language such.
XHTML Formatting font with a style declaration. Formatting Font HTML uses the font tag to change size and family of font But… the font tag is being deprecated.
CSS Fun damentals The Document Hierarchy Element Relationships The Box Model.
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
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.
- WE’LL LOOK AT THE POSITION PROPERTY AND HOW CSS RESOLVES CONFLICTS BETWEEN STYLING INSTRUCTIONS The position property; CSS specificity hierarchy.
NASRULLAHIBA.  It is time to take your web designing skills to the next level with Cascading Style Sheets (CSS). They are a way to control the look and.
LT: I can use CSS to decorate a web page. Do Now: Get your storyboard, and log in to winhome. Write our a list of colors you want in your website. (Minimum.
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.
CONFIGURING COLOR AND TEXT WITH CSS Chapter 3. Cascading Style Sheets (CSS) Used to configure text, color, and page layout. Launched in 1996 Developed.
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.
Working with Cascading Style Sheets
4.01 Cascading Style Sheets
>> Introduction to CSS
Cascading Style Sheets
Cascading Style Sheets (Layout)
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Cascading Style Sheets
4.01 Cascading Style Sheets
Web Programming and Design
Presentation transcript:

Web Design (12) CSS Introduction

Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML. By editing one style sheet, the appearance of the entire web site can be changed.

Cascading Style Sheets - Method 1. Produce the HTML page (‘structural layer’) 2. Write the style rules for how you wish certain elements to look (‘presentation layer’) 3. Attach the style rules to the document

Examples of CSS Rules h1 { color: green;} Selector Declaration Value p {font-size: 16px; font-family:sans-serif; } Selector Declaration Value Declaration Value

Exercise(1) 1.Create a new web site folder ‘cssintro’ 2.Place in it a blank.html and a small image 3.Enter 3 paragraphs of text on your home page, incorporating the image within the text. 4.Apply several h1, h2 and p tags to parts of your text 5.Look at your page in live preview

Exercise (2) 6. In the head area of the home page ( after the title element) enter the following code: h1 { color: green;} p {font-size: 16px; font-family:sans-serif; } 7. Look at your page in live preview – what do you notice?

Exercise (3) 8. Change the h1 color to ‘gray’ – check in live preview 9. Now change the h1 color to ‘red’ and again, check in live preview 10. Add a new CSS Rule that makes h2 elements red as well. h1 { color: red;} h2 { color: red;} p {font-size: 16px; font-family:sans-serif; }

Exercise (4) 11. Add a 100 pixel left margin to the p element using this declaration: margin-left : 100px; - look at the result in live preview 12. Add a 100 pixel left margin to the h2 headings also. Again, check live preview. h1 { color: red;} h2 { color: red; margin-left: 100px;} p {font-size: 16px; font-family:sans-serif; margin-left: 100px;}

Exercise (5) 13. Add a red 1 pixel border to the bottom of the h1 element using this declaration: border-bottom : 1px solid red; Check out the result in live preview. h1 { color: red; border-bottom:1px solid red;} h2 { color: red; margin-left: 100px;} p {font-size: 16px; font-family:sans-serif; margin-left: 100px;}

Exercise (6) 14. Move the image to the right margin and allow the text to flow around it with the float property, using this declaration: img { float: right; margin: 0 12px;} (Note: The pixel values after ‘margin’: the first relates to the space on the top and bottom of the image; the second to the space on the left and right of the image.) Check with Live Preview h1 { color: red; border-bottom:1px solid red;} h2 { color: red; margin-left: 100px;} p {font-size: 16px; font-family:sans-serif; margin-left: 100px;} img {float:right; margin: 0 12px;}

And two more things …… (1) Comments in Style Sheets: /* comment goes here */ (2) If you need to apply the same properties to a number of elements: h1, h2, p, img {border: 1px solid blue:}

Three ways of applying CSS (1) 1.Embedded Style Sheets ( in the head) Applies only to the page on which it appears. /*style rules go here*/

Three ways of applying CSS (2) 2. Inline Styles (in the body) These apply only to the particular element in which they appear Introduction Add this to your index page – and check the result

Three ways of applying CSS (3) 3. External Style Sheets (separate sheet from html page) Can apply to many pages in your web site More about these later ……..

Style Sheet Hierarchy What if contradicting styles appear in these 3 ways of applying CSS to HTML? Which takes priority? Answer: Inline, Embedded, External Note: This order can be changed by adding: !important to a style rule.

Four CSS Styles (1) Tag Style Used to change the appearance of an existing HTML tag. h1 {font-family: Arial; font-size: large;}

Four CSS Styles (2) ID Style Used mainly as building blocks in page layout. Well suited in formatting tags. Can only be used once per page. #wrapper {background-color: green; width: 950px; height: auto;} (Note the hash symbol before the ID style) On the HTML page, the ID Style appears (within body) as: …………………………..

Four CSS Styles (3) Class Style Can be used more than once per page. e.g. to create a caption under each photo on a page:.caption {font-family: Arial; color: red} (Note the dot before the class style) On the HTML page, class styles must be applied to an element such as p Family Photo

Four CSS Styles (4) Compound Style Created by combining ID, Class or Tag Styles. For example, to define a tag style within a particular element: #banner h1 A combination of id style and tag style So here, within the banner, all text is to be h1

Four CSS Styles A lot to take in, so put Class and Compound Styles to one side for the moment. You have already used Tag Styles. Next time we will be using Tag and ID Styles and will be considering External Style Sheets ….