HTML5 and CSS3 Illustrated Unit C: Getting Started with CSS.

Slides:



Advertisements
Similar presentations
1 © Netskills Quality Internet Training, University of Newcastle Introducing Cascading Style Sheets © Netskills, Quality Internet.
Advertisements

Introduction to HTML & CSS
Intro To Cascading Style Sheets By Mario Yannakakis.
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
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.
© 2004, Robert K. Moniot Chapter 6 CSS : Cascading Style Sheets.
HTML5 and CSS3 Illustrated Unit E: Inserting and Working with Links
HTML5 and CSS3 Illustrated Unit B: Getting Started with HTML
COMPSCI 345 / SOFTENG 350 TUTORIAL WEEK 8 | SAM KAVANAGH.
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.
4.01 Cascading Style Sheets
Review HTML  What is HTML?  HTML is a language for describing web pages.  HTML stands for Hyper Text Markup Language  HTML is not a programming language,
Cascading Style Sheets (CSS) Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
STYLING THE WEBSITE - EXTERNAL CSS BY JORGE MARTINEZ.
 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.
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.
Cascading Style Sheets (CSS) 1.  What is CSS?  Why CSS?  How to write a CSS? 2.
Using Styles and Style Sheets for Design
Introduction To CSS.. HTML Review What is HTML used for? Give some examples of formatting tags in HTML? HTML is the most widely used language on the Web.
 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.
Working with Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 5.
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 Sheet Introduction. What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles were added.
© 2011 Delmar, Cengage Learning Chapter 8 Using Styles and Design Style Sheets for Design.
CS134 Web Design & Development Cascading Style Sheets (CSS) Mehmud Abliz.
Linking to an External Style Sheet Web Design Section 4-3 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
Cascading Style Sheets Dreamweaver. Styles Determine how the HTML code will display Determine how the HTML code will display Gives designers much more.
Css. Definition Cascading style sheet (CSS)  It is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.
Cascading Style Sheets
Lesson 15: Cascading Style Sheets. Objectives Identify ways to apply Web page formatting with Cascading Style Sheets (CSS1 and CSS2) using various methods.
DYNAMIC HTML What is Dynamic HTML: HTML code that allow you to change/ specify the style of your web pages. Example: specify style sheet, object model.
Introduction to CSS. What is CSS? CSS ("Cascading Style Sheets") determines how the elements in our XHTML documents are displayed and formatted. By using.
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
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.
CSS Syntax. Syntax The CSS syntax is made up of three parts: a selector, a property and a value: selector {property: value}
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.
HTML5 and CSS3 Illustrated Unit B: Getting Started with HTML.
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…
CASCADING STYLE SHEET CSS. CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to solve a problem.
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.
HTML5 and CSS3 Illustrated Unit E: Inserting and Working with Links.
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.
Fall 2016 CSULA Saloni Chacha
Introduction to CSS: Selectors
Getting Started with CSS
Programming Web Pages with JavaScript
HTML5 and CSS3 Illustrated Unit D: Formatting Text with CSS
>> Introduction to CSS
Intro to CSS CS 1150 Fall 2016.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Website Design 3
Cascading Style Sheets - Building a stylesheet
Intro to CSS CS 1150 Spring 2017.
CS134 Web Design & Development
Cascading Style Sheets (Introduction)
Cascading Style Sheets (Introduction)
What are Cascading Stylesheets (CSS)?
Structuring Content in a Web Document
Web Design and Development
Web Design & Development
Cascading Style Sheets - Building a stylesheet
5.00 Apply procedures to organize content by using Dreamweaver. (22%)
One Set of Styles Connected to As Many Pages as You Want!!!
HTML5 and CSS3 Illustrated Unit B: Getting Started with HTML
Presentation transcript:

HTML5 and CSS3 Illustrated Unit C: Getting Started with CSS

Objectives Assess style rules Create an embedded style sheet Implement an id selector Implement the div element Implement a class selector HTML 5 and CSS 3 – Illustrated Complete

Objectives (continued) Create an external style sheet Link to an external style sheet Validate your CSS code HTML 5 and CSS 3 – Illustrated Complete

About CSS CSS: adds style information to elements defined in HTML code   Added by insertion of style rules Style rules: lines or blocks of CSS code that specify the presentation of Web page elements HTML 5 and CSS 3 – Illustrated Complete

CSS Syntax HTML 5 and CSS 3 – Illustrated Complete h1 { text-align: center; font-style: italic; } Parts of a CSS Style Rule Selector Curly Bracket Colon Semi- Colon 1 st Name-Value Pair 1 st Value 2 nd Value 2 nd Name-Value Pair

About CSS Style rules contain two main parts   Selectors: identify the HTML elements to which the rule applies   Name/Attribute-value pairs: specify CSS attribute to apply to the selector and value to assign to the attribute Each pair ends with a semicolon All attribute-value pairs surrounded by curly braces HTML 5 and CSS 3 – Illustrated Complete h1 { text-align: center; font-style: italic; }

About CSS Type selectors: selectors defined by names of HTML elements   Apply associated attribute-value pair to every instance of the specified element CSS supports name/attribute-value pairs for many aspects of Web page presentation   Allowable values are specific to each attribute HTML 5 and CSS 3 – Illustrated Complete

Creating an Embedded Style Sheet HTML 5 and CSS 3 – Illustrated Complete

Creating an Embedded Style Sheet Embedded Style Sheet: CSS code inserted in the head element of an HTML document   Most straightforward method for affecting the presentation of a single Web page CSS is inserted in a style element with an attribute specifying that the contents are written in CSS   HTML 5 and CSS 3 – Illustrated Complete

Implementing an id Selector id selector: affects the presentation of a specific element in an HTML document   Add id attribute to opening tag of an element to give it a unique value e.g., John Smith   Use the name in a CSS rule id selector Attribute value pairs following id selector affect only the identified element e.g., #name { text-align: right; } HTML 5 and CSS 3 – Illustrated Complete

Implementing an id Selector HTML 5 and CSS 3 – Illustrated Complete

Implementing a class Selector class attribute: can be added to multiple HTML elements class selector: creates a style rule based on values assigned to the class attribute   Allows style rule to be applied to unlimited number of separate elements   Consists of period followed by class attribute value HTML 5 and CSS 3 – Illustrated Complete

Implementing a class Selector HTML 5 and CSS 3 – Illustrated Complete

Implementing the div Element div element: generic HTML element free of semantic meaning   Groups elements of different types within a single element Contains all elements between opening and closing div tags   Allows you to assign CSS styles to a section of a Web document containing different types of elements HTML 5 and CSS 3 – Illustrated Complete

Implementing the div Element HTML 5 and CSS 3 – Illustrated Complete

Implementing the div Element HTML 5 and CSS 3 – Illustrated Complete

Creating an External Style Sheet External Style Sheet: separate file containing style information   Can be linked to multiple HTML pages   Suitable for maintaining a consistent style in large Web sites   Prevents need to implement style changes on each page of Web site In CSS code, content located between /* and */ is ignored by user agents HTML 5 and CSS 3 – Illustrated Complete

Use the HTML link element to link an HTML document to an external style sheet   rel and type attributes specify to the user agents that the external document is written in CSS   href attributes specifies the filename of the external style sheet   e.g., HTML 5 and CSS 3 – Illustrated Complete Creating an External Style Sheet

HTML 5 and CSS 3 – Illustrated Complete Creating an External Style Sheet

Linking to an External Style Sheet Style rules in an external style sheet can be applied to each page on a Web site   Simply add link element referencing the style sheet file to each HTML document Make changes to Web site style only in the external style sheet   Changes reflected in all pages linked to the style sheet HTML 5 and CSS 3 – Illustrated Complete

Validating Your CSS Code Important to validate CSS code against CSS rules even when CSS code works in browser testing   Helps ensure compatibility of code with different user agents   Helps ensure that code remains usable You can use online tools to validate your code   jigsaw.w3.org/css-validator/ HTML 5 and CSS 3 – Illustrated Complete

Summary CSS is a coding language that adds style information to HTML elements Styles defined by style rules   Contain selectors identifying the styled elements and attribute-value pairs identifying how the selected elements should be styled HTML div element can be used to group elements HTML 5 and CSS 3 – Illustrated Complete

Summary (continued) Different types of selectors affect different groups of elements   Type selector: applies to all HTML elements of a specific type, such as h1 elements   id selector: applies to a single element having a specific unique id   class selector: applies to all elements having a specific value to the class attribute HTML 5 and CSS 3 – Illustrated Complete

Summary (continued) Embedded style sheets are included in the HTML code   Suitable for single page Web sites External style sheets can be linked to multiple Web pages   All the Web pages can be changed by changing a single style sheet CSS code can be validated against CSS rules HTML 5 and CSS 3 – Illustrated Complete