Cascading Style Sheets

Slides:



Advertisements
Similar presentations
Introduction to HTML & CSS
Advertisements

Cascading Style Sheets (CSS). Cascading Style Sheets With the explosive growth of the World Wide Web, designers and programmers quickly explored and reached.
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
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 External Style.
Cascading Style Sheets
Cascading Style Sheets
It’s All About Style The Basics of Style Sheets Presented by Barry Diehl.
Introduction to CSS.
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. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
Chapter 8 Creating Style Sheets.
Introduction to Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 4.
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.
Understanding HTML Style Sheets. What is a style?  A style is a rule that defines the appearance and position of text and graphics. It may define the.
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.
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)
Cascading Style Sheets (CSS) 1.  What is CSS?  Why CSS?  How to write a CSS? 2.
Bare bones notes. Suggested organization for main folder. REQUIRED organization for the 115 folder.
1 WDMD 170 – UW Stevens Point WDMD 170 Internet Languages eLesson: CSS Introduction to Style Sheets (NON-audio version) © Dr. David C. Gibbs
ITCS373: Internet Technology Week 3: Introduction to CSS Dr. Faisal Al-Qaed.
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.
Cascading Style Sheets CSS by Pavlovic Nenad by. 2Cascading Style Sheets Presentation Contents What are CSS? What are CSS? History of CSS History of CSS.
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)
Essentials of HTML Class 4 Instructor: Jeanne Hart
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. 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.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
DIV, Span, CSS.
HTML GUIDE Press F5 and then Click on the links on the left to get to the section you want Section 1: Getting Started Section 2: Moving Banner Section.
Cascading Style Sheets CSS. Source W3Schools
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.
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.
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.
Cascading Style Sheets (CSS) EXPLORING COMPUTER SCIENCE – LESSON 3-5.
Practice for Chapter 3: Assume that you are a freelance web designer and need to create a website to promote your freelance company.
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.
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 Cascading Style Sheets. Session Checklist ► Learn why style sheets are needed and their advantages and disadvantages ► Learn the format of a style.
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.
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.
Cascading Style Sheets Part 1 1 IT 130 – Internet and the Web.
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.
4.01 Cascading Style Sheets
CX Introduction to Web Programming
Website Design 3
Cascading Style Sheets - Building a stylesheet
Introduction to Cascading Style Sheets (CSS)
Working with Cascading Style Sheets (CSS)
Working with Cascading Style Sheets (CSS)
What are Cascading Stylesheets (CSS)?
Cascading Style Sheets - Building a stylesheet
4.01 Cascading Style Sheets
5.00 Apply procedures to organize content by using Dreamweaver. (22%)
Presentation transcript:

Cascading Style Sheets Basic CSS Cascading Style Sheets

Objectives After today, you will be able to Describe Cascading Style Sheets (CSS) Explain why CSS is important Define styles for a Web site using CSS Evaluate the resultant style when styles are placed inline, in the <head> element, and in an external file.

What we’ve learned so far A bunch of HTML tags: HTML, HEAD, TITLE, BODY, H1-H6, A, IMG, TABLE, TR, TD, TH, BR, HR, P, FONT How and where to organize them on the page for layout and content How to do basic formatting of the content using attributes

What we’ve been doing: How easy is this to read? <table width="100%" height="100%" > <tr> <td width="285px" valign="top"> <a href="Home%20Page.html"> <font color="blue">Home</font></a><br> <p><b><font color="blue"> Categories</font></b></p><br> </td> </tr> </table> How easy is this to read?

Where we’re going: Formatting will be separate <table id=“sitenav”> <tr> <td > <a href="HomePage.html">Home</a> <p>Categories</p> </td> </tr> </table> Formatting will be separate

What are Cascading Style Sheets? Consistent format within a Web site One set of styles applied to all pages Web designers use them to easily change the look of entire Web site with a few simple changes in the CSS code. CSS defines how html elements are displayed. Introduce CSS. Cascading Style Sheets (CSS) are used to create a consistent look within a Web site. Remind students that a Web site is a collection of Web pages. By using CSS, a Web designer can create a consistent look between the pages of the site and easily change the look with a few simple changes of code.

Content vs. Style HTML is like the meat and vegetables of the web (the words of your page) CSS is like the spices, herbs, sauces, and garnishes (the formatting and layout)

History The Need for CSS The Result HTML defines the content of a Web page. With popularity of the Internet, style became important. HTML alone makes it difficult to separate style from the content. The Result World Wide Consortium (W3C) created styles as a part of HTML 4.0. CSS separates content from style. A separate CSS file can contain almost all of the style details for the Web site. Discuss the need for CSS. The original intent of HTML was to define the content of a Web page. As browsers grew and as the popularity of the Internet also grew, the separation between content and style became difficult. Style tags became intertwined with the content and made the development of a Web page extremely time consuming. The World Wide Consortium (W3C) developed styles which became a part of HTML 4.0. Styles allowed designers to separate the content from the style by creating a separate CSS file. This file would contain most of the information needed to provide the style of the Web page. The Web page file then references the CSS file to get direction for the style of the Web page.

Breaking it Down: Cascading Style Sheet Cascading – can be defined in multiple places, and they work in priority order: The style attribute <p style=“prop: value”> Styles in the document itself (in head tag) Style in external files Style - Just a fancy word for formatting Sheet - A collection of styles that can be quickly edited or replaced for a whole new look

CSS – Rules Selector Rule Property Value CSS Rule Syntax has 3 parts:

Selectors We’ll learn about selectors in the next lesson For today: they select or choose which HTML tags on the page their formatting applies to

Properties Rules can have multiple properties Comment Multiple properties Colors can be represented by hexadecimal numbers or pre-defined descriptive text.

3 ways to use styles Inline style: <p style=“prop: value”> Styles in the document itself (in head tag) Style in external files We’ll try all 3, but almost always use the last one

External Styles Define external style sheet in the <head> tag Exercise Open a new file in Notepad++ Select Language -> C ->CSS Type a CSS rule for the <p> tag that does the following: Sets the color Sets the font-family (i.e. verdana) Save as mystyles.css where favorites.html is Open favorites.html, add the <link> tag to the page to point to mystyles.css

Inline Styles Define CSS style in the HTML tags The style attribute can be added to many HTML tags Exercise Open your favorites assignment Find a <p> tag Specify a color for the <p> tag by using the style attribute Choose a color that is a part of the color scheme

Styles inside the file Define a CSS style in the <head> tag: Exercise: Open your favorites.html file In the <head> section, add a <style> block to specify the color for <p> tags

Best Practice / Requirements Use external styles for the web pages you design This is the best practice recommended by the industry All of our work in this class will do the same

Review Why is CSS important? What happens with the following? What is CSS? CSS defines how html elements are displayed. Why is CSS important? It separates the content from the style What happens with the following? ... <head> <style type="text/css"> p { color: #00FF00; } </style> </head> <body> <p style="color: #FF0000">1st Para</p> <p>2nd Para</p> …

Backup

Debugging with chrome Press f12 after going to a page to view its source Right click and select “Inspect Element”

Elements This is the html your browser is using, it will have “fixed” some of your mistakes in this view Use the Magnifying glass to find how the html is used.

History The Need for CSS The Result HTML defines the content of a Web page. With popularity of the Internet, style became important. HTML alone makes it difficult to separate style from the content. The Result World Wide Consortium (W3C) created styles as a part of HTML 4.0. CSS separates content from style. A separate CSS file can contain almost all of the style details for the Web site. Discuss the need for CSS. The original intent of HTML was to define the content of a Web page. As browsers grew and as the popularity of the Internet also grew, the separation between content and style became difficult. Style tags became intertwined with the content and made the development of a Web page extremely time consuming. The World Wide Consortium (W3C) developed styles which became a part of HTML 4.0. Styles allowed designers to separate the content from the style by creating a separate CSS file. This file would contain most of the information needed to provide the style of the Web page. The Web page file then references the CSS file to get direction for the style of the Web page.

Advantages of Using CSS Creates consistency within and across pages Example without a CSS file: A designer creates a Web page containing code for the heading to be bold, green, 32 pt. Arial font. On the second page of the site, a heading is entered but this time the designer enters 26 pt. font for the heading. Example with a CSS file: Designer creates a CSS file to define h1 as bold, green, 32 pt. Arial font. The CSS file is referenced on both the first and second page. Every time h1 is used, a heading is as bold, green, 32 pt. Arial font. A change in the CSS file automatically changes both pages. Discuss the advantages of using a CSS file. The CSS file defines the style elements and allows for the consistency between pages of a Web site. For example, on the first page of a Web site, the designer creates the code for the heading of the page to be bold, green, 32 pt. Arial font. Without CSS, the code to create this look is included with the content of the page. As the designer completes the first page, work is begun on the second page. This time the designer creates a similar heading but makes an error and enters the code to display the text at 26 pt. font. The pages now lack consistency. A designer using a CSS file might define h1 as bold, green, 32 pt. Arial font. A link to the CSS file is placed at the beginning of the Web page code and now the use of an h1 element will create text which bold, green, 32 pt. Arial font. The same reference to the CSS file on the second page will result in the same look for the heading on page 2.

Advantages of Using CSS Improves the load time for Web pages. CSS code serves as the directions for the browser to display both content and style. Once the style has been downloaded into memory (cached), subsequent pages using the same style will load faster. The use of CSS improves the load time for Web pages. When a Web page is loaded by a browser, the browser looks at the code and follows the directions of the code to create the page that we see. Once the browser has downloaded the first page, the information is stored in memory, or cached. The subsequent pages that use the same information will now load faster as the style created has now been cached. 24