4.01 Cascading Style Sheets

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.
Web Pages Week 10 This week: CSS Next week: CSS – Part 2.
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
Today CSS HTML A project.
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.
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.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
กระบวนวิชา 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.
CSS normally control the html elements. Three Ways to Insert CSS There are three ways of inserting a style sheet: External style sheet Internal style.
CSS Cascading Style Sheets Brief Introduction
Web Design with Cascading Style Sheet Lan Vu. Overview Introduction to CSS Designing CSS Using Visual Studio to create CSS Using template for web design.
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.
Design, Formatting, CSS, & Colors 27 February, 2011.
CSS Basics LIS Webteam April 8, Why CSS? What’s wrong with HTML? Structure vs Style Early web design used hacks to style webpages with HTML – like.
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.
Creating Web Pages with HTML and CSS ISY 475. HTML Introduction History: – Standard.
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.
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
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.
CSS Dvijesh Bhatt.
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)
The Characteristics of CSS
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
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.
CSS Netcentric. What is CSS O CSS stands for Cascading Style Sheets O Styles define how to display HTML elements O Styles were added to HTML 4.0 to solve.
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.
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)
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.
CSS Cascading Style Sheets. CSS Advantages Greater typography and page layout control Style is separate from structure Styles can be stored in a separate.
Web Design and Development for Business Lecture 4 Cascading Style Sheet (CSS)
CSS Tutorial 1 Introduction Syntax How to use style specifications. Styles.
DIV, Span, CSS.
Cascading Style Sheets CSS. Source W3Schools
Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.
Designing Web Pages The case for CSS. The Power of CSS css Zen Garden
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
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.
LT: I can use CSS to decorate a web page. Do Now: Get your storyboard, and log in to winhome. Write our a list of colors you want in your website. (Minimum.
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.
Cascading Style Sheet.
4.01 Cascading Style Sheets
Madam Hazwani binti Rahmat
Cascading Style Sheets (Layout)
CASCADING STYLE SHEET CSS.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Website Design 3
What are Cascading Stylesheets (CSS)?
Training & Development
Web Design & Development
4.01 Cascading Style Sheets
Web Programming and Design
Presentation transcript:

4.01 Cascading Style Sheets An introduction to 3 types of CSS

Introduction This presentation introduces the following: 3 types of CSS CSS syntax CSS comments CSS and color The box model

Why we need CSS Styles were added to HTML 4.0 because HTML has very few formatting tags. Styles define how to display HTML elements There are 3 types of CSS: Inline, Internal and External. The HTML formatting tags are in the optional section of the curriculum. Emphasis is placed on using CSS to style documents.

3 Types of CSS Inline Styles use the style attribute within an HTML tag. Inline styles only apply to that single instance of an HTML element. Internal Styles are contained in the head section and style a single web page. External Styles are saved in an external .css file. A single external style sheet can style an entire web site. Emphasize that the styles cascade. All 3 types can be used in a document.

Inline Styles The syntax for an inline style: <element-name style="property: value;"> Example: <body style="background-color: black;"> Multiple CSS property: value pairs can be entered in the same style attribute

Use Inline Styles Sparingly Inline styles use the style attribute in the relevant tag. Each instance must be styled. Internal and External styles save time and are easier to update. Emphasize that this is the style attribute not the style tag

Internal Styles Internal CSS styles a single web page according to the rules entered in the <head> section of the document. The <style> tag is required. CSS rules have two parts: a selector and one or more declarations. The selector is the HTML element to be styled. The declaration specifies the property and value.

When to use Internal CSS Use Internal CSS when a single document has a unique style. The <style> tag must be in the <head> section of the HTML page. <head> <style> body {background-color: black; } p {color: white; } </style> </head>

Internal CSS An Internal style sheet should be used when a single document has a unique style. You define internal styles in the head section of an HTML page, by using the <style> tag, like this: <head> <style> hr {color: sienna; } p {margin-left: 20px; } body {background-image: url (“images/back40.gif”); } </style> </head>

CSS Rule for h1 Heading 1 will display in text color blue and a 12 pixel font.

CSS selectors can appear in one line <html> <head> <style type="text/css"> body {background-color: black; } p {color: white; } </style> </head> <body> <p>White text on a black background!</p> </body> </html>

CSS selectors can appear in multiple lines <html> <head> <style type="text/css"> body { background-color: black; } P color: white; </style> </head> <body> <p>White text on a black background!</p> </body> </html>

External CSS uses link tag <head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> Emphasize that <link> must be in <head>

When to use External CSS External CSS is ideal when the styles should be applied to many pages. The styles in one file can be changed and the look of the entire web site will be updated. External styles can be written in a text editor. The file is then saved with .css extension. CSS files are text files.

External CSS An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire Web site by changing one file. Each page must link to the style sheet using <link> tag. The <link> tag goes inside the head section: <head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> An external style sheet can be written in any text editor. The file should not contain any html tags. Your style sheet should be saved with a .css extension. An example of this: hr {color: sienna; } p {margin-left: 20px; } body {background-image: url (“images/back40.gif”); } DO NOT ADD a space between the property value and the unit (such as margin-left:20 px). The correct way is: margin-left:20px

Multiple Style Sheets Multiple styles will cascade into one Inline styles have highest priority, then Internal styles, then External styles and then the Web browser default.

CSS Comments Comments are used to explain your code, and may help you when you edit the source code at a later date. Comments are ignored by browsers. A CSS comment begins with "/*", and ends with "*/“. CSS comments are different from HTML comments. They are two different languages.

CSS and Colors In CSS color is most often specified as either a HEX value (#ff0000), an RGB value (RGB(255,0,0) or a color name (red). Refer to a color chart for a complete list of values. You may want to visit http://w3schools.com/html/html_colors.asp

CSS color controls text color

CSS background-color

The CSS Box Model This is a conceptual model that relates to layout and objects.

What is the Box Model? All HTML elements can be considered as boxes. In CSS, the term "box model" is used when talking about design and layout. The CSS box model is essentially a box that wraps around HTML elements, and it consists of: margins, borders, padding, and the actual content. The box model allows us to place a border around elements and space elements in relation to other elements. An example of the box model is using margins, padding or borders around images.

The Box Model helps us understand the size of elements Important: When you set the width and height properties of an element with CSS, you just set the width and height of the content area. To calculate the full size of an element, you must also add the padding, borders and margins.

Box Model applied CSS Coding for an img img { width:250px; padding:10px; border:5px solid gray; margin:10px; } Here is the math for this element 250px (width) + 20px (left + right padding) + 10px (left + right border) + 20px (left + right margin) = 300px