Cascading Style Sheets

Slides:



Advertisements
Similar presentations
Introduction to HTML & CSS
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.
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.
Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site.
Cascading Style Sheets: Basics I450 Technology Seminar Copyright 2003, Matt Hottell.
Cascading Style Sheets (CSS) “Styles” for short. Pg. 418.
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.
CHAPTER 7 STYLING CONTENT WITH CASCADING STYLE SHEETS.
Making Things Look Nice: Visual Appearance and CSS CMPT 281.
Introduction to CSS. What is CSS? A CSS (cascading style sheet) file allows you to separate your web sites (X)HTML content from it’s style. Use your (X)HTML.
Introduction to CSS.
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.
Chapter 8 Creating Style Sheets.
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.
Introduction to Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 4.
1 Getting Started with CSS. 2 CSS Cascading Style Sheets XHTML provides structure for our documents (web pages) CSS provides Style or Presentation for.
4.01 Cascading Style Sheets
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.
Using Cascading Style Sheets (CSS) Dept. of Computer Science and Computer Information CSCI N-100.
Cascading Style Sheets (CSS) Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
 ult.htm ult.htm  This website illustrates the use of CCS (style sheets)
Cascading Style Sheets (CSS) 1.  What is CSS?  Why CSS?  How to write a CSS? 2.
I NTRO TO CSS IAT100 Spring I NTRO TO CSS Covered in this lesson: Overview What is CSS? Why to use CSS? CSS for Skinning your Website Structure.
1 WDMD 170 – UW Stevens Point WDMD 170 Internet Languages eLesson: CSS Introduction to Style Sheets (NON-audio version) © Dr. David C. Gibbs
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.
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.
Working with Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 5.
CO1552 – Web Application Development Cascading Style Sheets.
Cascade Style Sheet Introduction. What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles were added.
Css. Definition Cascading style sheet (CSS)  It is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.
Web Design and Development for Business Lecture 4 Cascading Style Sheet (CSS)
Cascading Style Sheets CSS. Source W3Schools
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
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.
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.
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.
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.
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
Style Sheets.
4.01 Cascading Style Sheets
Madam Hazwani binti Rahmat
CX Introduction to Web Programming
Cascading Style Sheets (CSS)
Intro to CSS CS 1150 Fall 2016.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Website Design 3
Cascading Style Sheets - Building a stylesheet
Intro to CSS CS 1150 Spring 2017.
Software Engineering for Internet Applications
Cascading Style Sheets
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
Made By : Lavish Chauhan & Abhay Verma
Cascading Style Sheets - Building a stylesheet
4.01 Cascading Style Sheets
Presentation transcript:

Cascading Style Sheets October 3, Unit 4

What are Cascading Style Sheets? Abbreviated CSS Same principle as design templates in MS PowerPoint Allows you to specify the style for your webpage Can change fonts, colors, sizes, etc. 1 style sheet can be used for multiple pages Adds consistency to your site Saves a lot of work!

Why were CSS Created? Originally HTML was designed only for logical markup <p>, <h1>, etc. The browser was supposed to take care of the layout and look of the page But, IE, Netscape, and other browsers started adding tags and attributes so people could specify how the document would also look Physical markup CSS allow developers to separate the content of the page from the style

Beginning CSS External CSS are text files Have the file extension .css Create style sheets just like an html document Can use any text editor Better with syntax highlighting Can also be embedded in your html document using the style attribute These are Internal Style Sheets Better to create a separate file so you can apply the style sheet to many pages

How CSS Work Browsers have a default style for each tag You’ve overridden some of the defaults (probably) while writing assignment 1 CSS allows you to override the default style Perform the same function as the physical markup in your html documents from assignment 1 Because you can use an external file, multiple html documents can link to a single css file Saves a lot of tedious writing

Cascading? Style sheets can be specified in a number of ways: In an html element (a tag) In the head tag As an external css file Even have multiple css files for a single document These multiple definitions cascade into a new, virtual style sheet

Cascading Priority Multiple styles can be declared for a single element Have to have a priority From lowest to highest: Browser default External Style Sheet Internal Style Sheet Inline style

Where Best to Define Style Sheets External Style Sheets: Great when there are multiple pages for the same site Allow you to change look of entire site by editing a single file Best for general layout and overall look of all pages Colors Font family Font size Tables, like color, cellspacing, etc. Any of the elements you want to be consistent across the site

Where Best to Define Style Sheets Internal Style Sheets: Great if you only have a single page Or pages which are wildly different Also useful if you want most of your page to be the same as others on your site, but change a few elements For example, changing colors Inline Style Good for quick markup of a page Should only be used in the published version when you want to change the look of a single item once or twice

Writing Style Sheets Style Sheets are made up of rules which change the default style for the browser Each rule has three parts: Selector Properties Values Looks like: selector{ property: value; }

Parts of a Rule Selector: Property: Value: “selects” what will be modified Simplest selector would be a tag <p>, <h1>, etc. Property: What is going to be changed You already know things like color, font-size, etc. Can have any number of properties Value: Specifies what the value of the property should be changed to For instance changing the color to “red” The property: value parts are very similar to the attribute: “value” specified inline

Simple CSS Rule Lets change our default font size and color for paragraphs p { color: orange; font-size: 150%; }

Changing Heading Defaults What if we want all of our headings to be a different color and a different font? h1 { color: #FFFF33; font-family: Verdana, serif; } h2 { h3 { etc.

Grouping h1, h2, h3, h4, h5, h6 { color: #FFFF33; Instead of listing all the headings in the Style Sheet we can group them to cut down on how much is written and help with readability h1, h2, h3, h4, h5, h6 { color: #FFFF33; font-family: Verdana, serif; }

Grouping, cont. Grouping is more efficient than listing each selector separately Big help for readability Can group any selectors h1, p, { text-align: center; color: #FF3366; } You should use grouping when writing your style sheets

Applying an External Style Sheet To use an external style sheet we’re going to use the <link> tag The <link> tag goes inside of the <head> tag Example: <head> <link rel = “stylesheet” href =“style.css” type = “text/css” /> </head>

Parts of the <link> Tag <link rel = “stylesheet” href =“style.css” type = “text/css” /> rel: the type of relation In this case “stylesheet” To see the types of relations available check out the <link> tag in the XHTML1.0 reference href: the file Just like a hyperlink In this case its style.css and it’s in the same directory type: specifies the MIME type Here it is text/css Though servers usually supply the MIME type, sometimes it’s incorrect for css files Specify the MIME type when linking style sheets

Applying an Internal Style Sheet If a single page is different from the rest, use an Internal Style Sheet Same syntax as an external style sheet Insert an internal style sheet using the <style> tag Goes inside of the <head> tag

<Style> Tag <head> <style type = “text/css”> h1{ color: red;} p { color: orange; font-family: sans-serif; } </style> </head>

Multiple Style Sheets Lets say all of our pages use the same style sheet But, we want to change a few items on one of the pages Can override the external style sheet using an internal style sheet

Multiple Style Sheets, cont External Style Sheet h1 { color: red; font-size : 18pt; font-family: serif; } Internal Style Sheet h1 { font-size : 20pt; font-family: sans-serif; }

Resulting “Virtual” Style Sheet color: red; font-size : 20pt; font-family: sans-serif; } The style sheet “cascades” Any properties defined remain As you get to higher priority style references, the old values get overwritten

Multiple Sheets Example External p { color: #FF123C; text-align: center; } Internal p { color: red; font-size: 20pt; } Final Sheet p { color: orange; text-align: center; font-size: 18pt; font-family: sans-serif; } Inline p { color: orange; font-size: 18pt; font-family: sans-serif; }

Simple Style Sheet In Class Example We’ll go over a bit on paragraphs, headings, and backgrounds