Cascading Style Sheets 1 Color and Backgrounds. Cascading Style Sheets 2 Color and Backgrounds Computer color basics Expression of color values using.

Slides:



Advertisements
Similar presentations
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
Advertisements

1 Pengantar Teknologi Internet W03: 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.
Cascading Style Sheets Color and Background Controls Border and Margin Controls (Boxes)
Week 9 Using the Box Properties. 9-2 The CSS Visual Formatting Model Describes how the element content boxes should be displayed by the browser –Based.
Tutorial 5 Working with the Box Model. XP Objectives Understand the box model Create padding, margins, and borders Wrap text around an image Float a block-level.
CS4370/6370 Web Development Cascading Style Sheets (CSS)
Web Design & Development Cascading Style Sheets (CSS)
CS134 Web Design & Development Cascading Style Sheets (CSS) Mehmud Abliz.
TUTORIAL 4: CREATING PAGE LAYOUT WITH CSS Session 4.3.
Workshop: CSS-Part I Cascading Style Sheets add style to your HTML web pages.
Style sheets can also affect the BODY. style4.css BODY {BACKGROUND-COLOR : white} H1 {COLOR : red; FONT-SIZE : 50; FONT-FAMILY : arial} H2 {COLOR : green}
Style sheets can also affect the body. style4.css body {background-color : white} h1 {color : red; font-size : 50; font-family : arial} h2 {color : green}
4.01 Cascading Style Sheets
Chapter 8 Graphics and Color
CSS Dvijesh Bhatt.
HTML/CSS Hyper Text Markup Language. CSS Cascading Style Sheets.
Cascading style sheets (CSS)
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
Cascading Style Sheets CSS. CSS - Structure Declaration block Property: identifies what to change Value: how to change it Selector – example h1{ font-size:
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
Week 8 Graphics and Color. 8-2 Understanding Graphic Files Formats.
1 Cascading Style Sheets (CSS) Part 2. 2 The Sources of Style Sheets.
INTRODUCTION TO HTML5 Styling Text. Change the Font Size  You can use the font-size property to change the font size for a document’s text.  Instead.
Chapter 12 Cascading Style Sheets: Part II The Web Warrior Guide to Web Design Technologies.
(CSS) More Details Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Adding Graphics to Web Pages. CSS does not have any properties specifically aimed at formatting images Use properties you have already learned, i.e.,
Cascading Style Sheets in.NET Lilian Kiilu, Client/Server & Web Applications, Coms 463/563, Section 1pm, Fall 2005, November 16 th 2005.
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
MySQL and PHP Review CSS. Cascading Style Sheet (CSS) Style sheets are files or forms that describe the layout and appearance of a document. Cascading.
Cascade Style Sheet Introduction. What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles were added.
Lesson 03 // Cascading Style Sheets. CSS Stands for Cascading Style Sheets. We’ll be using a combination of Html and CSS to create websites. CSS is a.
More CSS.
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
INTRODUCTORY Tutorial 4 Exploring Graphic Elements and Images.
Cascading Style Sheets Chapters 5-6 Color and Background Controls Border and Margin Controls.
>> The “Box” Model. Pre-requisite Create a new project in Netbeans called Week5 Create a new html file and name it box.html Create a new css file and.
 Cascading Style Sheets (CSS) ◦ Used to specify the presentation of elements separately from the structure of the document.  Inline style ◦ declare.
CSS The Definitive Guide Chapter 9.  As has been stressed in CIS 131 or your initial learning of HTML5 “Planning” is important!  It is even more true.
Colors and backgrounds The following CSS properties will be explained: 1.color 2.background-color 3.background-image 4.background-repeat 5.background-attachment.
So far, we have looked at CSS selectors that correlate with HTML tags Now, we’ll see how you can define your own selectors using class and ID selectors.
DIV, Span, CSS.
Cascading Style Sheets Eugenia Fernandez IUPUI. CSS Purpose CSS allow you to specify the style in which your XML elements are displayed. CSS were originally.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
DHTML AND JAVASCRIPT Genetic Computer School LESSON 4 CASCADING STYLE SHEET G H E F.
Microsoft Expression Web 3 – Illustrated Unit F: Enhancing a Design with CSS.
CSU - DCE Introduction to CSS CSS Colors - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying Color Instructor: Joseph.
Colors and backgrounds The following CSS properties will be explained: 1.color 2.background-color 3.background-image 4.background-repeat 5.background-position.
3.2 Cascading Style Sheets. 2 Positioning Elements Normally, elements are laid out on the page in the order that they are defined in the XHTML document.
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
Web Design (15) CSS Opacity, Link Colours & Background Images.
CIS234A Lecture 6 Instructor Greg D’Andrea. Span and Div The span and div elements are a generic means by which we can add structure to documents. The.
Tutorial #5 Working with the Box Model. Tutorial #4 Review - CSS Create a homework page Final Project Discussion Exam on Blackboard Styling Lists (List-style-type,
PERSPECTIVES: TUTORIAL 4 CREATING PAGE LAYOUTS WITH CSS.
Chapter 7.  Change body and link styles  Create a drop-down menu  Change color and font styles in the menu  Create a pop-up effect using CSS  Utilize.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
1 CS428 Web Engineering Lecture 07 Font, Text & Background (CSS - II)
HTML & CSS Contents: the different ways we can use to apply CSS to The HTML documents CSS Colors and Background CSS Fonts CSS Text CSS box model: padding,
Chapter 13 Colors & backgrounds.
CSS Layouts CH 13.
( Cascading style sheet )
Cascading Style Sheets
CSS Borders and Margins.
Cascading Style Sheets Color and Font Properties
Tutorial 3 Working with Cascading Style Sheets
Cascading Style Sheets
Presentation transcript:

Cascading Style Sheets 1 Color and Backgrounds

Cascading Style Sheets 2 Color and Backgrounds Computer color basics Expression of color values using color name, hexadecimal value, and RGB value Specifying element content and link colors using the COLOR property Specifying the background color, images and background image position using the BACKGROUND properties

Cascading Style Sheets 3 Working With Color RGB: Red, green, and blue. –Intensity ranges (from none to full) Color depth. –Amount of data used to create the color. 8-bit (256 colors), 16-bit, 24-bit (16 million colors). Browser-safe palette (216 colors). –Displays properly on PC & Mac

Cascading Style Sheets 4 Working With Color Specifying CSS color values –CSS allows the specification of color in one of three ways: Color names RGB color values Hexadecimal color values

Cascading Style Sheets 5 Working With Color Specifying CSS color values –Using color names Sets color values using common color names –Such as yellow, red, blue, aqua, lime etc. –Limited to small range of colors Not detailed enough

Cascading Style Sheets 6 Color Names Aqua00FFFFMaroon Black000000Navy Blue0000FFPurple Gray808080RedFF0000 Green008000Teal Lime00FF00WhiteFFFFFF

Cascading Style Sheets 7 Working With Color Specifying CSS color values –Using RGB colors Hex Decimal Percentage The following rules specify the same color: P {color: #00FFFF;} P {color: rgb(0, 100%, 100%);} P {color: rgb(0, 255, 255);}

Cascading Style Sheets 8 Specifying Color Specify foreground color of elements on a web page Browser dependent Applies to: all elements Can change link colors Can change default of new, active, and visited links

Cascading Style Sheets 9 Specifying Default Color Setting the default text color Color is inherited from parent to child elements BODY {color: #006633;} Will set color for entire page, since all elements inherit from

Cascading Style Sheets 10 Background-color Set background color of any element on a web page (including padding area) Setting the page background color Use BODY as the selector By default, background color of any element is transparent –Example: BODY {background-color: #CCCCCC;}

Cascading Style Sheets 11 Background-color 2 Creating a text reverse –Example: Text color is white and background color is gray H1 { color: #FFFFFF; Background-color: gray; Padding:.25em; }

Cascading Style Sheets 12 Working With Backgrounds Specifying a background image –Allows addition of a background image to entire web page -or to single element Value: –Creating a page background Use the BODY element as the selector Example: –Tiles an image across entire background of the web page –BODY {background-image: url(picture.gif);}

Cascading Style Sheets 13 Working With Backgrounds Specifying a background image –Creating an element background Images can be applied to background of any element Example: –Applies an image to the background of the h1 element –h1 {background-image: url(bluetext.jpg); padding: 2em;}

Cascading Style Sheets 14 Repeat Background Controls tiling of background images –Value: repeat | repeat-x | repeat-y | no-repeat | inherit Specifying background repeat –Creating a vertical repeat Example: –Repeats image vertically –BODY {background-image: url(bluecurtain.jpg); Background-repeat: repeat-y;}

Cascading Style Sheets 15 Repeat Horizontal Background Creating a horizontal repeat –Allows creation of a horizontally repeating background graphic Example: –Repeats image vertically –BODY {background-image: url(bluecurtain.jpg); Background-repeat: repeat-x;}

Cascading Style Sheets 16 Non-Repeating Background Non-repeating background image –Allows creation of a single instance of an image in the background Example: –Repeats image vertically –BODY {background-image: url(bluecurtain.jpg); Background-repeat: no-repeat;}

Cascading Style Sheets 17 Background position Specifying background position –Controls position of background images Length top | center | bottom left | center | right Percentage –Percentages: refers to the size of the box itself

Cascading Style Sheets 18 Creating centered background image Like a printed watermark on web page Example: –Centers background image BODY {background-image: url(grayivy.jpg); background-repeat: repeat-y; background-position: center;}

Cascading Style Sheets 19 Percentage Background Positions Left Top 0% Center Top 50% 0% Right Top 100% 0% Left Center 0% 50% Center 50% Right Center 100% 50% Left Bottom 0% 100% Center Bottom 50% 100% Right Bottom 100% 100%

Cascading Style Sheets 20 Specifying Background Position Positioning Vertical and Horizontal Background Images Positions images that repeat on either the horizontal or vertical axis of the web page Example: –Positions the vertical repeating background image along the right side of the browser window BODY {background-image: url(grayivy.jpg); background-repeat: repeat-y; background- position: right;}

Cascading Style Sheets 21 Background Shorthand Shorthand property allows setting of background properties in a single statement –background-color –background-image –background-repeat –background-attachment –background-position Percentage is allowed on background- position

Cascading Style Sheets 22 Background-repeat Property Values Repeat Default; image repeated across entire background Repeat-x image repeated across x axis (horizontal) Repeat-y image repeated across y axis (vertical) No-repeat image is NOT repeated: only one instance is displayed

Cascading Style Sheets 23 Summary Color varies greatly on the web. Different environment display colors differently. Test colors and use web-safe colors. Do not use color name but RGB. Use the COLOR property to set foreground colors for elements. Border defaults to element color. Background colors affect padding areas in the element Background colors can be applied to both block-level and inline elements.