Cascading Style Sheets. Next Level Cascading Style Sheets (CSS) - control the look and feel of your HTML documents in an organized and efficient manner.

Slides:



Advertisements
Similar presentations
Cascading Style Sheets
Advertisements

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.
Web Development & Design Foundations with XHTML Chapter 3 Key Concepts.
Cascading Style Sheets
Cascading Style Sheets
CSS The basics { }. CSS Cascading Style Sheets - language used to – describe html appearance & formatting Style Sheet - file that describes – how html.
Cascading Style Sheets: Basics I450 Technology Seminar Copyright 2003, Matt Hottell.
Cascading Style Sheets
Introducing CSS CIS 133 mashup Javascript, jQuery and XML 1.
Fun with Formatting: DIV tags and Cascading Style Sheets Dr. donna Bair-Mundy.
Introduction to CSS.
CHAPTER 8 ADVANCED CSS. LEARNING OBJECTIVES Assign formatting styles to a CSS class definition Use a tag’s class attribute to apply the styles defined.
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.
HyperText Markup Language (HTML) Uses plain text to add markup instructions to a file. If you can't produce it with a standard keyboard, it can't go into.
CSS cont. October 5, Unit 4. Padding We can add borders around the elements of our pages To increase the space between the content and the border, use.
กระบวนวิชา 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.
Measurement Many CSS properties (values within the declaration) require that you specify a unit of measurement, such as spacing between elements, border.
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.
Stylin’ with CSS. 2 Topics What is CSS? Why CSS? CSS Examples.
1 CSS Styling with Fonts and Colors. 2 CSS Cascading Style Sheets and fonts CSS provides Style or Presentation options for our html pages CSS properties.
Web Workshop: CSS Objectives: - “What is CSS?” - Structure of CSS - How to use CSS in your webpage.
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.
Workshop: CSS-Part I Cascading Style Sheets add style to your HTML web pages.
4.01 Cascading Style Sheets
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
HTML BASIC
Stylin’ with CSS. 2 Topics What is CSS? Why CSS? CSS Examples.
HIGHER COMPUTING CSS. WHAT IS CSS? CSS: Cascaded Style Sheets used to separate a web site’s content(information) from its style(how it looks).
Chapter 11 Cascading Style Sheets: Part I The Web Warrior Guide to Web Design Technologies.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
Tutorial #3 Cascading Style Sheets. Review: Last Class Image sizing Pathnames Project Default Path Relative Path Absolute Path Blackboard Homework Submission.
Copyright (c) 2004 Prentice-Hall. All rights reserved. 1 Committed to Shaping the Next Generation of IT Experts. Formatting Text and Lists Essentials for.
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.
Using Cascading Style Sheet As you create more web pages, you may wish to impose a consistent look for all of your web pages or for group of related pages.
Tutorial 5 Formatting with CSS. Objectives Session 5.1 – Evaluate why CSS styles are used – Determine where to write styles – Create an element selector.
Tutorial #3 Cascading Style Sheets. Tutorial #2 Review - Anchors Links to Site DMACC Internal Links Go to Top Mail To me Local.
Stylin’ with CSS Monday October 8 th and Tuesday October 9 th.
College of Micronesia- FSM Pohnpei State Campus GEORGE S. MANGONON, MBA Chair, Math/Sci Division September 15-25, 2008.
Creating Your Own Webpage COSC Cascading Stylesheets Think of: HTML: content of your webpage HTML has tags CSS: presentation and appearance of your.
Colors & Fonts Building a Website Lesson 7. Font Font The tag specifies the font face, font size, and color of text. The tag can have any or all of these.
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.
12/20/20151 Color Fall, 2010 Modified by Linda Kenney 10/26/10.
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
Web Design (14) CSS Formatting Text. Formatting Text In Brackets, go to your ‘externalcss’ website and find the ‘formattingtext’ page. Use the ‘main’
Introduction To CSS by: Alexandra Vlachakis Sandy Creek High School, Fayette County Schools Content and Resources Used With Permission: Interact With Web.
CSS Cascading Style Sheets *referenced from
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.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
CSS DHS Web Design. Location Between the & Start with – End with –
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 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.
The Internet 10/11/11 Fonts and Colors
4.01 Cascading Style Sheets
Creating Your Own Webpage
CSS Rule Selector Declaration Block Value Attribute Name body {
>> Introduction to CSS
Cascading Style Sheets
Cascading Style Sheets - Building a stylesheet
Stylin’ with CSS.
The Internet 10/6/11 Cascading Style Sheets
Cascading Style Sheets - Building a stylesheet
Stylin’ with CSS.
Cascading Style Sheets
4.01 Cascading Style Sheets
Stylin’ with CSS.
CGS 3066: Web Programming and Design Fall 2019
Presentation transcript:

Cascading Style Sheets

Next Level Cascading Style Sheets (CSS) - control the look and feel of your HTML documents in an organized and efficient manner. With CSS you will be able to: Add new looks to your old HTML Completely restyle a web site with only a few changes to your CSS code Use the "style" you create on any webpage you wish!

CSS Selector CSS selectors are the heart and soul of CSS. They define which HTML elements you are going to be manipulating with CSS code In a typical CSS statements you have the following: SELECTOR { PROPERTY: VALUE } Where the property is the CSS element you wish to manipulate and "VALUE" represents the value of the specified property.

CSS Selector If you wanted to change the way a paragraph tag behaved the CSS code would look like: p { PROPERTY: VALUE } NOTE: The styles must be define in the HEAD of the HTML page NOT in the body page.

Internal “Local” Styles: ex6a.html p {color: white; } body {background-color: black; } White text on a black background!

CSS – General Format "HTML tag" { "CSS Property" : "Value" ; }  We chose the HTML element we wanted to manipulate. - p{ : ; }  Then we chose the CSS attribute color. - p { color: ; }  Next we chose the font color to be white. - p { color: white; }  We choose the HTML element Body - body { : ; }  Then we chose the CSS attribute. - body { background-color: ; }  Next we chose the background color to be black. - body { background- color: black; }

CSS – General Format and example body { background-color: gray; } p { color: maroon; } Internal CSS This page uses internal CSS. Using the style tag we are able to modify the appearance of HTML elements.

Some pre-defined colors Here are some of the colors and the predefined hexadecimal number Black000000Cyan 00FFFF Gray808080Teal SilverC0C0C0Green WhiteFFFFFFOlive Maroon800000Lime 00FF00 RedFF0000Yellow FFFF00 MagentaFF00FF Purple Blue0000FF Navy000080

Text-level Styles font-familyNamed font Use quotations for multiple names: " Courier New " font-sizePercent Percent relative to font size of parent element font-styleNormal, italic, oblique font-weightBold, bolder, lighter, normal Bolder is equivalent to what.. creates colorNamed color, #hexcolor background-colorName color, #hexcolor Makes solid colored block around text.

Generic text-level styles  You can predefine how you want a set of text to be displayed instead of the default given.  Use tag: Example: text to be different  In the style section, you define what you want for the span tag ie. span { font-size:150%; font-family=Verdana; color:maroon; }

Internal CSS Exercise: ex6b.html  use internal style definitions, construct the following page at the bottom.  You need to modify or stylize the following: - text in maroon - text in blue - text in black (hint your default will be maroon based on the “paragraph” setting” - gray

Types of Style - Classes Recall that as styles are defined as  element_name { property1: value; property2: value;} example: p {font-size: 150%; color: blue;}  What if you want to have different types of “paragraphs”?  You create “subclasses” and define them as follows: element. classname { property1: value; property2: value;} example: p.bigblue {font-size: 150%; color: blue;} p.smallred {font-size; 50%; color: red;} Placed Period here

Types of Style - Classes span {font-weight: normal; font-size: normal;} span.boldred {font-weight: bolder; color: red;} span.italicblue {font-style: italic; color: blue;} b {font-size: normal} b.big {font-size: 150%;} b.small {font-size: 75%} b.bigbolder {font-size: 150%; font-weight: bolder;}

Calling a “class” span {font-weight: normal; font- size: normal;} span.boldred {font-weight: bolder; color: red;} span.italicblue {font-style: italic; color: blue;} b {font-size: normal} b.big {font-size: 150%;} b.small {font-size: 75%} b.bigbolder {font-size: 150%; font- weight: bolder;} This will be normal This line will be in italic and blue </span this is normal bold this is smaller bold this is BIG BOLDER

External Cascading Style Sheet  When creating web pages, it is preferable to keep the style on a separate sheet  Placing CSS in a separate file allows the web designer to completely differentiate between content(HTML) and design(CSS).  It keeps your website design and content separate.  It's much easier to reuse your CSS code if you have it in a separate file. Instead of typing the same CSS code on every web page you have, simply have many pages refer to a single CSS file with the "link" tag.  You can make drastic changes to your web pages with just a few changes in a single CSS file.

body { background-color: gray; } p { color: blue; } h3 { color: red; } <link rel="stylesheet“ type="text/css" href= "myStyle.css" /> A Red Header This paragraph has a blue font. The background color of this page is gray because we changed it with CSS! myStyle.cssex6b.html

Fun and Goodies – Pseudo Classes  Probably the coolest thing about CSS is the ability to add effects to your anchor tags, otherwise known as hyperlinks  A link has four different states that it can be in that can be customized.  link - this is a link that has not been used, nor is a mouse pointer hovering over it  visited - this is a link that has been used before, but has no mouse on it  hover - this is a link currently has a mouse pointer hovering over it/on it  active - this is a link that is in the process of being clicked

How to define links? a:STATE'S NAME { attribute: value; } Style definition: a:link { color: blue; } a:visited { color: red; } a:hover { color: green; } HTML call: This is a special CSS Link

How to remove default underline? a:(STATE'S NAME) { attribute: value; } Style definition: a:link { color: blue; text-decoration: none; } a:visited { color: red; text-decoration: none; } a:hover { color: green; } More fancy a:link { text-decoration: none; color: gray; } a:visited { text-decoration: none; color: gray;} a:hover { text-decoration: none; color: maroon; font-weight: bolder; }

Exercise 7 – Modify exercise 5  Modify your exercise 5. Copy the whole directory ex5 to ex7 directory  Include an external cascading style sheet in both home.html and projects.html  Modify the link so that the links have no underlines and when you “hover” the links, it changes color. See sample code.