Introduction to CSS.

Slides:



Advertisements
Similar presentations
Cascading Style Sheets
Advertisements

1 © Netskills Quality Internet Training, University of Newcastle Introducing Cascading Style Sheets © Netskills, Quality Internet.
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.
Intro To Cascading Style Sheets By Mario Yannakakis.
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.
Computer Applications II.  A Style Sheet is a web page development tool that allows the developer to make global changes to a web page (or web site)
Cascading Style Sheets
1 Cascading Style Sheets™ (CSS) Outline 5.1 Introduction 5.2 Inline Styles 5.3 Embedded Style Sheets 5.4 Conflicting Styles 5.5 Linking External Style.
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.
CHAPTER 7 STYLING CONTENT WITH CASCADING STYLE SHEETS.
CSS. CSS, or Cascading Styles Sheets, is a way to style HTML. Whereas the HTML is the content, the style sheet is the presentation of that document.
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.
1 Web Developer & Design Foundations with XHTML Chapter 9 Key Concepts.
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.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
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.
Chapter 8 Creating Style Sheets.
CSS Cascading Style Sheets Brief Introduction
Introduction to Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 4.
4.01 Cascading Style Sheets
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.
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.
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)
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
Essentials of HTML Class 4 Instructor: Jeanne Hart
Web Design and Development for Business Lecture 4 Cascading Style Sheet (CSS)
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.
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.
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.
Introduction to CSS. What is CSS? CSS ("Cascading Style Sheets") determines how the elements in our XHTML documents are displayed and formatted. By using.
Cascading Style Sheets I Embedded Style Sheets. Page Design ICSS 2Instructor: Sean Griffin What is a Style Sheet? A style sheet is a text file that contains.
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.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
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.
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.
CSS.
4.01 Cascading Style Sheets
Introduction to CSS.
Madam Hazwani binti Rahmat
CX Introduction to Web Programming
Cascading Style Sheet (CSS)
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Website Design 3
Cascading Style Sheets - Building a stylesheet
Introduction to CSS.
Introduction to Cascading Style Sheets (CSS)
What are Cascading Stylesheets (CSS)?
Cascading Style Sheets™ (CSS)
Tutorial 3 Working with Cascading Style Sheets
Web Design and Development
Introduction to CSS.
Cascading Style Sheets - Building a stylesheet
4.01 Cascading Style Sheets
External Style Sheets.
Cascading Style Sheets III B. Com (Paper - VI) & III B
Introduction to Cascading Style Sheets (CSS)
Cascading Style Sheets™ (CSS)
CGS 3066: Web Programming and Design Fall 2019
Presentation transcript:

Introduction to CSS

CSS Defined: Short for "Cascading Style Sheets". Determines how the elements in our XHTML documents are displayed and formatted. Designed to separate the content of a web page from the presentation of that content. Enables us to make all pages of our website look similar and consistent (font, color, etc.). Allows us to make site-wide formatting changes from a single location (rather than having to edit each page individually).

Three Ways to Use CSS: Inline Style - CSS is placed directly into the XHTML element. Internal Style Sheet - CSS is placed into a separate area within the <head> section of a web page. External Style Sheet - CSS is placed into a separate computer file and "connected" to a web page.

CSS Format Conflicts: It's possible for CSS formatting to be defined in all three locations at the same time. For example, a paragraph element could contain an inline style (color:red) but the internal style sheet (color:blue) and the external style sheet (color:green) give conflicting instructions to the web browser. Web browsers need a consistent way of "settling" this disagreement.

What is Meant by "Cascading"? We use the term cascading because there is an established order of priority to resolve these formatting conflicts: Inline style (highest priority) Internal style sheet (second priority) External style sheet (third priority) Web browser default (only if not defined elsewhere) For each XHTML element, the browser will check to see which inline styles are defined, then those styles in the internal style sheet, and finally those styles in the external sheet. For all conflicts, it will use this priority system to determine which format to display on the page. In the prior example, the paragraph would display as red, because the inline style "outranks" all the others.

A semicolon must follow each style declaration. Example: Inline Style <h2 style="font-family:georgia; color:red;"> CAUTION: Stormy Weather! </h2> PREVIEW: A semicolon must follow each style declaration. An inline style declaration like this one will affect only that particular element. In other words, other <h2> elements on the page will not be affected by this formatting. Because inline styles do not properly separate content and presentation, their use is discouraged. We will not be using inline styles in this class.

Example: Internal Style Sheet <head> <style type="text/css"> h2 {font-family:georgia; color:red;} </style> </head> For internal style sheets, all formatting declarations are placed inside the <style> element within the <head> section of the document. An element is listed and all the styling information follows, surrounded by opening and closing curly brackets, { }. A semicolon must still follow each style declaration. Styles declared in the internal style sheet will affect all matching elements on the page. In this example, all <h2> elements on the page will be displayed in Georgia font and in red color.

Example: External Style Sheet <head> <link rel="stylesheet" type="text/css" href="style.css" /> </head> style.css (separate file): h2 {font-family:georgia; color:red;} For external style sheets, a <link> tag is placed at the beginning of the <head> section of the document specifying the external style sheet (with a .css extension) to be used for formatting. The external style sheet uses the same syntax as the internal style sheet when listing elements and their styling. Styles declared in an external style sheet will affect all matching elements on all web pages that link to the stylesheet. In this example, all <h2> elements on all pages using this style sheet will be displayed in Georgia font and in red color.

Internal vs. External Style Sheets Internal style sheets are appropriate for very small sites, especially those that have just one page. Internal style sheets might also make sense when each page of a site needs to have a completely different look. External style sheets are better for multi-page websites that need to have a uniform look and feel to all pages. External style sheets not only make for faster-loading sites (less redundant code) but also allow designers to make site-wide changes quickly and easily.

CSS Terminology and Syntax: Correct syntax: selector {property:value;} p {color:red;} Selector Property Value Be careful to put the semicolon after each declaration. It is the single most common mistake made by those learning CSS.

Setting Multiple Properties: color:red; font-style:italic; text-align:center; } You can define as many selectors as you wish for the element you are formatting. In the above example, all paragraph elements will now show red italic text that is centered on the page. Many designers choose to place the selector and the open bracket on a dedicated line and the closing bracket on its own line too. By doing this, all the selectors in between are aligned and easy to read.

Setting a Background with CSS: body { background-image:url('picture.gif'); background-repeat:repeat-x; background-color:red; } With background-image, you can specify an image to be placed in the background of your web page. If you specify a background image, you can also decide whether the image will "tile" across or down the screen. Possible values for the background-repeat property include repeat-x (horizontally only), repeat-y (vertical only), and no-repeat (no tiling at all). If you don't specify this property at all, by default the image will repeat up and down to fill the entire page. You can use the background-color property to set one solid color for the background. Even if you specify a background image, it is good practice to specify a color too. If for some reason the background image is not available, the background color will be shown instead.

CSS Text Properties: The following properties can be specified for any element that contains text, such as <h1> thru <h6>, <p>, <ol>, <ul>, and <a>: Property Some Possible Values text-align: center, left, right, justify text-decoration: underline, line-through, blink color: blue, green, yellow, red, white, etc. font-family: Arial, Verdana, "Times New Roman" font-size: large, 120%, 20px (pixels) font-weight: bold, normal font-style: italic, normal For a full list of available color names, refer to the following page: http://www.w3.org/TR/css3-color/#svg-color