Web Foundations TUESDAY, OCTOBER 1, 2013 LECTURE 4: HTML COLOR CODES, INTRO TO CSS STYLES.

Slides:



Advertisements
Similar presentations
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Advertisements

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
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.
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.
กระบวนวิชา 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.
Lecture 5. CSS 2 What style will be used when there is more than one style specified for an HTML element? Generally speaking we can say that all the styles.
4.01 Cascading Style Sheets
INTRO TO WEB DEVELOPMENT
Instructor: Mike Panitz Crash Course in CSS.
Using Cascading Style Sheets (CSS) Dept. of Computer Science and Computer Information CSCI N-100.
Accessing CSS THREE WAYS: INLINE, INTERNAL, AND EXTERNAL STYLE SHEET.
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,
IT Introduction to Website Development Welcome!
Cascading Style Sheets (CSS) Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
Chapter 4 Cascading Style Sheets Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
STYLING THE WEBSITE - EXTERNAL CSS BY JORGE MARTINEZ.
 ult.htm ult.htm  This website illustrates the use of CCS (style sheets)
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)
Cascading Style Sheets (CSS) 1.  What is CSS?  Why CSS?  How to write a CSS? 2.
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.
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.
آموزش طراحی وب سایت جلسه چهارم– سی اس اس 1 تدریس طراحی وب برای اطلاعات بیشتر تماس بگیرید تاو شماره تماس: پست الکترونیک :
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)
Bare bones slide show. The format is text files, with.htm or.html extension. Hard returns, tabs, and extra spaces are ignored. DO NOT use spaces in file.
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
Cascade Style Sheet Introduction. What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles were added.
Web Design and Development for Business Lecture 4 Cascading Style Sheet (CSS)
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.
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.
Introduction To CSS by: Alexandra Vlachakis Sandy Creek High School, Fayette County Schools Content and Resources Used With Permission: Interact With Web.
Style Sheets. Coding Style Sheets  Style sheets use RULES to create the style  A selector (a tag or user-defined style name)  and then declarations.
1 CSS محمد احمدی نیا 2 Of 21 What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements 
CSS Cascading Style Sheets *referenced from
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.
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.
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.
Cascading Style Sheets
Cascading Style Sheet.
4.01 Cascading Style Sheets
BIT116: Scripting Lecture 03
CASCADING STYLE SHEET CSS.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Website Design 3
Cascading Style Sheets
What are Cascading Stylesheets (CSS)?
Web Design and Development
4.01 Cascading Style Sheets
Presentation transcript:

Web Foundations TUESDAY, OCTOBER 1, 2013 LECTURE 4: HTML COLOR CODES, INTRO TO CSS STYLES

HTML Color Codes Red/Green/Blue Hecadecimal Triplets abcdef Red/Green/Blue RGB Decimal Code X11 Color Names thistle, magenta, indigo, gray, grey HSL/HSV °, %, % Web Safe Colors VGA 256  216  (6 × 6 × 6 = 216) each from 00 to FF /* RGB model */ #F00 /* 3-digit shortchand hex form #rgb */ #FF0000 /* 6-digit traditional hex form #rrggbb */ rgb(255, 0, 0) /* integer range */ rgb(100%, 0%, 0%) /* float range 0.0% % */ /* RGB with alpha channel, added to CSS3 */ rgba(255, 0, 0, 0.5) /* 0.5 opacity, semi-transparent */ /* HSL model, added to CSS3 */ hsl(0, 100%, 50%) /* red */ hsl(120, 100%, 50%) /* green */ hsl(120, 100%, 25%) /* dark green */ hsl(120, 100%, 75%) /* light green */ hsl(120, 50%, 50%) /* pastel green */ /* HSL model with alpha channel */ hsla(120, 100%, 50%, 1) /* green */ hsla(120, 100%, 50%, 0.5) /* semi-transparent green */ hsla(120, 100%, 50%, 0.1) /* very transparent green */

What is 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 of separating content from the way it is formatted and displayed External Style Sheets can save a lot of work by adding formatting and display configuration to an entire web site External Style Sheets are stored in.css files CSS is a way to style and present the information offered in an HTML page. Whereas the HTML is the meaning or content, the style sheet is the presentation of that document, including its font size and type, item colors, item formatting, margins and padding, rows and columns, in short the look and feel of a web page or entire web site.

Three Ways to Insert CSS into an HTML Page Inline Style Internal Style Sheet External Style Sheet CSS Styling LabCSS Styling Lab and Styling with External Style Sheets [due Wednesday, October 9, by midnight]Styling with External Style Sheets

Inline Style Inline style does exactly what it sounds like, it adds a style or styles in direct line with the HTML code itself (i.e., it is "embedded" inline with the HTML code) An inline style loses many of the advantages of style sheets by mixing content with presentation. To use inline styles you use the style attribute in the relevant tag. The style attribute can contain any CSS property. The example below shows how to change the font color and the left and right margins of a paragraph: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut pellentesque iaculis luctus. Phasellus quis faucibus turpis. Ut convallis quam id risus mattis lobortis. Cras quis augue vulputate, laoreet mauris id, pharetra ligula. Curabitur placerat sem eros, non rhoncus justo sollicitudin eu.

Internal Style Sheet 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 tag, like this: p {margin-left:20px; margin-right:600px; color:red;} body {background-color: #ffff99;}

CSS Syntax A CSS declaration always ends with a semicolon, and declaration groups are surrounded by curly brackets or "squiggles": p {color:red; text-align:center;} NOTE: We will talk about creating and using "class" and "id" in CSS in a future lecture

External Style Sheet 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 the tag. The tag goes inside the head section: 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 and given any name you choose appropriate to your design intentions (e.g., style.css). An example of a style sheet file is shown below: p {color:red; margin-left:20px; margin-right:600px; } body {background-color: #cccc66; } style.css index.html FYI: link rel is link relation and in our case it is a "stylesheet". There are other types of relations besides stylesheet, like author, help, license, search, to name a few.

Style Sheet Element Formatting p {color:red; margin-left:20px; margin-right:600px; } body {background-color: #cccc66; } The way you format your style sheet is really up to you. Pick a style that you like and then stick with it for consistency. p {color:red; margin-left:20px; margin-right:600px;} body {background-color: #cccc66;} p { color:red; margin-left:20px; margin-right:600px; } body { background-color: #cccc66; }

Multiple Style Sheets and Types If some properties have been set for the same selector in different style sheets, the values will be inherited from the more specific style sheet. For example, an external style sheet has these properties for the h3 selector: h3{ color:red; text-align:left; font-size:8pt;} And an internal style sheet has these properties for the h3 selector: h3{text-align:right; font-size:20pt;} If the page with the internal style sheet also links to the external style sheet the properties for h3 will be: color:red;  from the external text-align:right;  from the internal font-size:20pt;  from the internal The color is inherited from the external style sheet and the text-alignment and the font-size is replaced by the internal style sheet.

Styles can be specified three ways : inside an HTML element inside the head section of an HTML page in an external CSS file Tip: multiple external style sheets can be referenced inside a single HTML document. Cascading Order What style will be used when there is more than one style specified for an HTML element? Generally speaking we can say that all the styles will "cascade" into a new "virtual" style sheet by the following rules, where number four has the highest priority: 1. Browser default 2. External style sheet 3. Internal style sheet (in the head section) 4. Inline style (inside an HTML element) So, an inline style (inside an HTML element) has the highest priority, which means that it will override a style defined inside the tag, or in an external style sheet, or in a browser (a default value). NOTE: If the link to the external style sheet is placed after the internal style sheet in HTML, the external style sheet will override the internal style sheet!

Pros and Cons of the Three Different CSS Styles Inline Style Pros – Fast, down-and-dirty way to get styles into the code; great for testing or roughing out an idea; comes in handy in unique situations Cons – Can be tedious because it's on an item by item basis; if you want to change a style you have to work down through your code to find the style, and you've have to do this through your entire page, then you'd have to repeat this through all your other pages whose style you want to change in the same way Internal Style Pros – Almost as fast as inline style Cons – If you have multiple pages that use the same internal style, and you change one page, then you have to go through ALL your pages to manually change the CSS style to make sure all your pages are the same External Style Pros – It is common for websites to have common 'theme' across all its pages. You can club all such common styles in external file and with one download you get the required style that can be used in multiple pages: saves download time; if you want to change style throughout your entire site, you only have to do this in the external file, and not manually going through each one of your pages (saves a LOT of time if you have many pages in your site) Cons – There will be one additional HTTP request for each external style sheet you have