INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.

Slides:



Advertisements
Similar presentations
Introduction to HTML & CSS
Advertisements

CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site.
Cascading Style Sheets
HTML Overview - Cascading Style Sheets (CSS). Before We Begin Make a copy of one of your HTML file you have previously created Make a copy of one of your.
Making Things Look Nice: Visual Appearance and CSS CMPT 281.
© 2004, Robert K. Moniot Chapter 6 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.
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.
Introduction to Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 4.
Using Cascading Style Sheets CSS Structure. Goals Understand how contextual, class and ID selectors work Understand how contextual, class and ID selectors.
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.
Using Cascading Style Sheets (CSS) Dept. of Computer Science and Computer Information CSCI N-100.
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.
 Missing (or duplicate) semicolons can make the browser completely ignore the style rule.  You may add extra spaces between the properties/values to.
Cascading Style Sheet. What is CSS? CSS stands for Cascading Style Sheets. CSS are a series of instruction that specify how markup elements should appear.
XHTML and CSS Introduction to XHTML and CSS Bharti Patel 1 phones off (please)
1 Web Developer Foundations: Using XHTML Chapter 9 Cascading Style Sheet Concepts.
Cascading Style Sheets (CSS) Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
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 11 Cascading Style Sheets: Part I The Web Warrior Guide to Web Design Technologies.
Cascading Style Sheets Dreamweaver. Styles Determine how the HTML code will display Determine how the HTML code will display Gives designers much more.
 ult.htm ult.htm  This website illustrates the use of CCS (style sheets)
Different ways to implement CSS. There are four different ways to use CSS in your web pages: – Inline CSS – Embedded CSS/Internal CSS – Linked CSS/External.
Cascading style sheets (CSS)
Cascading Style Sheets (CSS) 1.  What is CSS?  Why CSS?  How to write a CSS? 2.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
Cascading Style Sheets. Defines the presentation of one or more web pages Similar to a template Can control the appearance of an entire web site giving.
I NTRO TO CSS IAT100 Spring I NTRO TO CSS Covered in this lesson: Overview What is CSS? Why to use CSS? CSS for Skinning your Website Structure.
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.
Web Programming Language Dr. Ken Cosh Week 2 (CSS I)
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.
Css. Definition Cascading style sheet (CSS) Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.
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.
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.
CSS Basic (cascading style sheets)
 cascade Style Sheets (CSS) is a mark-up language that was first proposed in 1994 by Håkon Wium Lie. CSS works in conjunction with HTML to greatly increase.
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.
CS134 Web Design & Development Cascading Style Sheets (CSS) Mehmud Abliz.
Cascading Style Sheets Dreamweaver. Styles Determine how the HTML code will display Determine how the HTML code will display Gives designers much more.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Tutorial 7.
Css. Definition Cascading style sheet (CSS)  It is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.
Web Design and Development for Business Lecture 4 Cascading Style Sheet (CSS)
INTRODUCTION TO CSS. TOPICS TO BE DISCUSSED……….  Introduction Introduction  Features of CSS Features of CSS  Creating Style Sheet Creating Style Sheet.
DIV, Span, CSS.
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. Source W3Schools
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.
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,
Cascading Style Sheets
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
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.
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.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
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…
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.
Madam Hazwani binti Rahmat
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Website Design 3
Presentation transcript:

INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE

22 Outline CSS Next class More CSS

Introduction to CSS Created by Hakon Lie, who was working with Tim Berners-Lee in the early 1990s.Hakon Lie Hakon is now Chief Technology Officer for the Opera browser maker. CSS: Cascading Style Sheet HTML: specify structure and content of a web page CSS: for presentation, how to display HTML Elements 3

4 Introduction to CSS CSS is a declarative language,declarative language statements -> rules. Rules -> layout, positioning, fonts, and visuals such as colours and images. CSS are really text files, or text in an HTML file, that allow the use of specific styles, attributes, and positioning of HTML objects. CSS defines how HTML elements are to be displayed. Separates the layout from the content. Formatting could be removed from HTML doc, and stored in a separate CSS file. Control the style and layout of multiple web pages all at once External Style Sheets in CSS files can save a lot of work. All browsers support CSS today.

What can CSS do? Discussion…

6 Advantages Define the look of your pages in one place, and apply it throughout the whole site. Easily change the look of your pages even after they're created. Change style once. Pages will be loaded faster, since they aren't filled with tags that define the look. The style definitions are kept in a single CSS document that is only loaded once when a visitor enters your site.

7 Where to place it CSS can be added to your pages at 3 different levels: (1)Create CSS styles that only works for a single tag (Inline). Single tag CSS is used when the style is used in a single place on the entire site. (2)Usually a certain style appears more than once on your pages, and thus you should use the second technique: adding styles that are defined once for the entire page (Internal, embedded). (3)If, however, that certain style is used on more than a single page, you should use the third - and most powerful - technique described: adding styles that are defined once for the entire site (External).

8 Single Tags CSS for single tags by simply adding the following to the tags. style="styledefinition:styleattribute;" NOT me. You should limit your use of single tag CSS. losing much of the power associated with CSS. repeating same definition Difficult changing a certain style. Have to change it all over in your document, rather than in one place. Css.html

9 Single Pages CSS can be defined for entire pages by simply adding a style definition to the head section. Define once (in ), use many times through the page. Easily change the styles of the page, even after the entire page has been made. Since the styles are only defined in one place, the page size will be smaller, and thus faster to load. Css.html

10 Entire Sites CSS can be defined for entire sites - by simply writing the CSS definitions in a plain text file - that is referred to from each of the pages in the site. Define testCSS.css file Add the line to the of all your pages, then the one style definition will be in effect for your entire site. Flexibility to make changes to the layout even after the site is done. Guarantee that all pages are following the same style Css.html

CSS Syntax selector { property: value; property: value; /*.. CSS comment... */ }  Selector: HTML element to style.  Property: style attribute to change.  Each property has a value h1 {color: blue; font-size: 12px;} 11

12 Single TagsSingle pages/ Entire sites Selector p {property: value} Property p {color: value; text-align: value} Value p { color: rgb(102,153,0); text-align: center; } CSS Syntax

13 CSS how to - external style sheet (Entire site) Be used, when the style is applied to many pages. Place to the of the.html link: link.css file to.html rel: the relationship from.html to.css href:.css type: media type. ‘text/css’ for css media: specify the media to which the style sheet applies. By default, screen.

14 CSS how to- inline style Losing many of the advantages of style sheets by mixing content with presentation. The style attribute may be applied to any element within the section. CSS declarations are separated by a (;) semicolon. Not encouraged.

15 CSS how to – multiple style sheets If some properties have been set for the same selector in different style sheets, the values will be inherited from the more specific style sheet. e.g., external CSS: h3 { color:red; text-align:left; font-size:8pt; } e.g., Internal CSS: h3 { text-align:right; font-size:20pt; } Final results for h3: color:red; text-align:right; font-size:20pt;

16 Multiple Styles Will Cascade into One Styles can be specified: - inside an HTML element (inline) - inside the head section of an HTML page ( internal) - in an external CSS file (external) Cascading order (priority increasing order): - Browser default - External style sheet - Internal style sheet (in the head section) - Inline style (inside an HTML element) So, an inline style (inside an HTML element) has the highest priority, which means that it will override a style defined inside the tag, or in an external style sheet, or in a browser (a default value). Note: If the link to the external style sheet is placed after the internal style sheet in HTML, the external style sheet will override the internal style sheet! Css.html

Basic CSS Selectors HTML tag Selectors Class Selectors Id Selectors Contextual Selectors Grouping Selectors 17

Tag Selectors html tag is a possible CSS selector Any html tag is a possible CSS selector. The selector is simply the tag that is linked to a particular style. p { text-indent: 20px; } E.g, p { text-indent: 20px; } 18

19 Class Selectors use a style on some tags in a document, but not all instances of the tag. a style for several tags in a document, without repeating the style rule. Do NOT start a class name with a number! This is only supported in Internet Explorer.

Class Selectors In p.blue { background-color: #0000ff; }.all_red { background-color: #ff0000; } Use class: using class p.blue using class.all_red 20

21 id Selectors similar to a class selector. give a name to a specific style without associating it with a tag or other HTML element id must have a unique value. The value must start with a # followed by letters (A--Z, a--z), digits (0--9) or hyphens (-). Do NOT start an id name with a number! It will not work in Mozilla/Firefox.

id Selectors #indent1 { text-indent: 10px; } Use id: hello world 22 Css_class_id.html

23 Differences between class & id ID: - Each element can have only one ID. - Each page can have only one element with that ID. Class: - You can use the same class on multiple elements. - You can use multiple classes on the same element. - one element can have more than one class, delimited by space: CSS does not care, JavaScript cares. Elements can have both:

Contextual Selectors  Indicate the context of a selector.  The context of a selector is determined by what its parent element is.  what the element is nested within or what precedes it in the document. – E.g., ol ul { font-size: 16px; }  Explanation: for any unordered list that is nested within an ordered list - change the font size to 16px. 24

Grouping Selectors  Group the selectors that share the same style in comma-separated list h1, h2, h3 h1, h2, h3 { font-family: Serif; color: blue;} 25

26 CSS how to - div The tag defines logical divisions, acting like a paragraph tag. The tag is a block-level element The tag can contain nearly any other tag The tag cannot be inside tags You can use the tag when you want to center or position a content block on the page.

27 Tips of Using tag div The tag is not a replacement tag. The tag is for paragraphs only, The tag defines more general divisions within a document. Don't replace tags with tags. It's always a good idea to close your tags as soon as you open them. Then place the contents within the element. If you nest your tags, be sure that you know where your content is going (in other words, which DIV it should be part of).

28 CSS how to - span Similar to the div element in function with one difference, span is an inline element - do not begin a new line. Can only contain other inline elements. The span element can be a selector and accept style, class and id attributes. The primary difference between the and tags is: – doesn't do any formatting of it's own. – includes a paragraph break, because it is defining a logical division in the document. – The tag simply tells the browser to apply the style rules to whatever is within the. Css.html

Summary 29 All in one example Css.html testCss.css

Next Class More CSS 30

Thank you!