Getting Started with CSS

Slides:



Advertisements
Similar presentations
CSS-Formatting Review Cascading Style Sheets addstyle to your HTML web pages.
Advertisements

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.
Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site.
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.
HTML5 and CSS3 Illustrated Unit B: Getting Started with HTML
Cascading Style Sheets Controlling the Display Of Web Content.
Cascading Style Sheets Controlling the Display Of Web Content.
 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
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Working with Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 5.
CSS Basic (cascading style sheets)
© 2011 Delmar, Cengage Learning Chapter 8 Using Styles and Design Style Sheets for Design.
Cascading Style Sheets Part 1. CSS vs HTML HTML: Originally intended to markup structure of a document (,...,,,,,...) CSS Developing technology, CSS1,
CS134 Web Design & Development Cascading Style Sheets (CSS) Mehmud Abliz.
Introduction to Cascading Style-sheets (CSS) Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan 1.
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. Why CSS? CSS Provides Efficiency in Design and Updates CSS relatively easy to use Can give you more flexibility and control Faster.
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
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 C: Getting Started with CSS.
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.
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.
Introduction To CSS. Lesson 1: History of CSS CSS was proposed in 1994 as a web styling language. To helps solve some of the problems HTML 4. There were.
CSS (Cascading Style Sheets). CSS CSS – Cascading Style Sheets – Cascade because of the way CSS rules can stack on top of each other. Allows you to add.
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
Laying out Elements with CSS
Web Basics: HTML/CSS/JavaScript What are they?
Programming Web Pages with JavaScript
HTML5 and CSS3 Illustrated Unit D: Formatting Text with CSS
Formatting Text with CSS
4.01 Cascading Style Sheets
Bare boned notes.
>> Introduction to CSS
Cascading Style Sheets
Madam Hazwani binti Rahmat
CX Introduction to Web Programming
Cascading Style Sheets (CSS)
Introduction to Web programming
Intro to CSS CS 1150 Fall 2016.
CASCADING STYLE SHEET CSS.
Filezilla problems continuing
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Website Design 3
Cascading Style Sheets - Building a stylesheet
Intro to CSS CS 1150 Spring 2017.
CSS.
CS134 Web Design & Development
What are Cascading Stylesheets (CSS)?
Structuring Content in a Web Document
Tutorial 3 Working with Cascading Style Sheets
Web Design and Development
Exercise 9 Skills You create and use styles to create formatting rules that can easily by applied to other pages in the Web site. You can create internal.
CSS.
Web Design & Development
Cascading Style Sheets - Building a stylesheet
4.01 Cascading Style Sheets
5.00 Apply procedures to organize content by using Dreamweaver. (22%)
External Style Sheets.
Web Programming and Design
HTML5 and CSS3 Illustrated Unit B: Getting Started with HTML
Presentation transcript:

Getting Started with CSS

Objectives Assess style rules Create an embedded style sheet Implement an ID selector Implement a class selector Use multiple selectors HTML 5 and CSS 3 – Illustrated Complete

Objectives (continued) Create an external style sheet Link to an external style sheet Add a comment to a style sheet Debug and validate CSS code HTML 5 and CSS 3 – Illustrated Complete

Assess Style Rules CSS (Cascading Style Sheets): adds style information to elements defined in HTML code Style rules: lines or blocks of CSS code that specify the presentation of web page elements Declarations: basic building block of CSS, includes a property name and a value, e.g. text-align: center HTML 5 and CSS 3 – Illustrated Complete

Assess Style Rules (continued) Style rules contain two main parts Selectors: identify the HTML elements to which the rule applies Declarations: specify CSS property to apply to the selector and value to assign to the property Each declaration (property: value) ends with a semicolon All declarations surrounded by curly braces HTML 5 and CSS 3 – Illustrated Complete

Assess Style Rules (continued) CSS style rule CSS properties and values HTML 5 and CSS 3 – Illustrated Complete

Create 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 Generally used only with a single web page Labor intensive to update embedded styles if added to lots of web pages HTML 5 and CSS 3 – Illustrated Complete

Create an Embedded Style Sheet (continued) Embedded style rule and resulting web page HTML 5 and CSS 3 – Illustrated Complete

Implement an ID Selector id selector: affects the presentation of a specific HTML element Add id attribute to opening tag of an HTML element to give it a unique value e.g., <p id=“name”> John Smith </p> Use # and id value to create CSS id selector for a style rule e.g., #name {text-align: right;} HTML 5 and CSS 3 – Illustrated Complete

Implement an ID Selector (continued) Style rule using id selector HTML 5 and CSS 3 – Illustrated Complete

Implement an ID Selector (continued) Presentation resulting from use of ID selector HTML 5 and CSS 3 – Illustrated Complete

Implement a Class Selector class attribute: can be assigned 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; e.g. .accent HTML 5 and CSS 3 – Illustrated Complete

Implement a class Selector (continued) class attribute and style rule with class selector added HTML 5 and CSS 3 – Illustrated Complete

Implement a class Selector (continued) Presentation resulting from use of class selector HTML 5 and CSS 3 – Illustrated Complete

Use Multiple Selectors Multiple selectors allow you to add the same style rule to multiple HTML elements Type selector name, comma, space (optional), next selector name Type a curly brace, followed by the declaration(s), followed by a curly brace HTML 5 and CSS 3 – Illustrated Complete

Use Multiple Selectors (continued) Commonly used CSS selectors HTML 5 and CSS 3 – Illustrated Complete

Create an External Style Sheet External style sheet: separate file containing style information Suitable for maintaining a consistent style in large websites Prevents need to implement style changes on each page of website Changes made to external style sheet are reflected in all web pages linked to that style sheet Can be linked to multiple HTML pages HTML 5 and CSS 3 – Illustrated Complete

Create an External Style Sheet (continued) HTML 5 and CSS 3 – Illustrated Complete

Link to an External Style Sheet Use the HTML link element to link an HTML document to an external style sheet, e.g. <link rel=“stylesheet” href=“mystylesheet.css” /> Attributes of the link element HTML 5 and CSS 3 – Illustrated Complete

Link to an External Style Sheet (continued) Web page linked to an external style sheet and the style sheet HTML 5 and CSS 3 – Illustrated Complete

Link to an External Style Sheet (continued) Multiple pages styled by external style sheet HTML 5 and CSS 3 – Illustrated Complete

Add a Comment to a Style Sheet Use comments in CSS style sheet to document the file Syntax for style sheet comments /* for opening tag [comment text] */ for closing tag Format for style sheet comments Can be single line Can be multi-line HTML 5 and CSS 3 – Illustrated Complete

Add a Comment to a Style Sheet (continued) Style sheet with comment added HTML 5 and CSS 3 – Illustrated Complete

Debug and Validate CSS Code Important to debug and 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 HTML 5 and CSS 3 – Illustrated Complete

Debug and Validate CSS Code (continued) Use developer tools to debug code, such as developer tools in Chrome HTML 5 and CSS 3 – Illustrated Complete

Debug and Validate CSS Code (continued) Use online service to validate CSS code, such as W3C validation service page HTML 5 and CSS 3 – Illustrated Complete

Summary HTML and CSS are complementary languages CSS uses style rules HTML specifies the page content CSS indicates how the content should be displayed CSS uses style rules Selector, which identifies the HTML element Declaration, which includes a property name and a value 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 id selector: applies to a single element having a specific unique id class selector: applies to elements with a value specific to the class attribute Multiple selectors: applies the same rule(s) to different elements HTML 5 and CSS 3 – Illustrated Complete

Summary (continued) Embedded style sheets are included in the HTML code Suitable for single page websites External style sheets can be linked to multiple web pages All linked web pages can be changed by changing a single style sheet Use the link element to link a web page to a CSS style sheet HTML 5 and CSS 3 – Illustrated Complete

Summary (continued) Use comments to document the style sheet /* [comment text] */ Use developer tools to debug CSS code Use online validation service to validate CSS code against CSS rules HTML 5 and CSS 3 – Illustrated Complete