CSS: Cascading Style Sheets

Size: px
Start display at page:

Download "CSS: Cascading Style Sheets"

Transcription

1 What are Style Sheets CSS: Cascading Style Sheets Representation and Management of Data on the Internet, CS Department, Hebrew University, 2007 A style sheet is a mechanism that allows to specify how HTML (/XHTML/XML) pages should look The style is specified by style rules The style rules appear either in the document or in external files, called style sheets W3Schools CSS tutorial 1 2 Style Sheets Usually, a file that ends with.css For example: Without a style sheet (i.e., with the default style definitions) - i.a.cnn.net/cnn/.element/ssi/css/1.1/main.css (CNN) - (HUJI) To attach a style sheet to an HTML file, add <link rel="stylesheet" type="text/css" href="css-file"/> to the head You can link to more than one css file 3 4 Simple Example without css <html> <head><title>a Joke</title></head> <body> <div><img src="tomato.gif" alt="joke"/></div> <h1>a joke</h1> div defines a division/section in a document. Using div you to group block elements and give them an equal style <p>a mama tomato, a papa tomato and a baby tomato are walking down the street. The baby tomato keeps falling behind so the papa tomato goes back, steps on the baby tomato and says, ketchup ("Catch-up!"). </p> </body> </html> 5 6 1

2 Style File: joke.css Simple Example - with css body { background-image: url("bg.gif"); } h1 { background-color: green; color: rgb(250, 200, 250); /* pink */ font-family: cursive} p { background-color: yellow; color: purple; font-size: 200%;} 7 <html> <head><title>a Joke</title> <link rel="stylesheet" type="text/css" href="joke.css"/> </head> <body> <div><img src="tomato.gif" alt="joke"></div> <h1>a joke</h1> <p>a mama tomato, a papa tomato and a baby tomato are walking down the street. The baby tomato keeps falling behind so the papa tomato goes back, steps on the baby tomato and says, ketchup ("Catch-up!"). </p> </body> </html> Open joke.html, joke_css.html 8 Background: Style in Legacy HTML In traditional HTML, every HTML tag which supported changing its font/colour/etc, supported this using a different syntax. Even tags which provided attributes which control their appearance, allowed for very limited customization. At a certain point, it was clear that because of these issues, the entire styling part of HTML needed to be revamped. One possibility to address this could have been adding a great number of standard styling attributes (spacing, font size, location, etc ) to all tags. Customizing each and every tag Why is this approach bad? with >10 attributes would have made HTML pages impossible to 9 write without automated tools! 10 The Solution: Style Sheets The Transition to Style Sheets Separates content from style Keeps HTML pages human-readable (how?) Reduces download time (how?) Allows to easily maintain a consistent appearance over a whole Web site (how?) A more flexible, unified way to specify style properties for different HTML elements (tables, paragraphs, etc ) 11 Style Sheets provide far more control over the appearance of the document than was available before but they also create redundancy: they provide new ways to accomplish tasks which were already possible. Once style sheets were introduced, most of the legacy features which provided equivalent functionality were deprecated in HTML 4.01 and in Transitional XHTML and were removed in Strict XHTML. It is good practice to use strict XHTML! 12 2

3 h1 { Style Rules Style Rules (cont) color: purple; Selector font-family: Impact, Arial Black; font-size-adjust:.46; Declaration A rule has the following form selector {declaration block} font-size: 2.33em; Property font-weight:400; Value(s) font-style:normal; text-decoration: none; word-spacing:normal!important; letter-spacing:normal; important rule The selector determines when the rule is applied For example, the following rule applies to text that is inside a <p> tag p{color: green; font-size: 1.5em; font-style: italic} text-transform: none; } 13 em is the current font-size of the current element 14 What Kind of Properties can a CSS Style Sheet Change? Style properties Layout properties There are many properties and many possible values - We will not cover all of them here - Look in the Web!!! Style Properties Our Examples We use the following HTML example: This is <span> our example </span> for css. The <span> tag is used to group inline elements for formatting with styles - Extremely useful tag... Font Properties Font properties: family, size, weight, style, variant,... span { font-family: courier; font-size: 130%; font-style: italic; font-weight: bold} Enable to transform letters into small-caps

4 Text Properties Text properties: color, transform, decoration, Transforms the letters case (upper / lower / capital) span { color: #00cc00; text-decoration: line-through; text-transform: uppercase} Background Properties Background properties: background-color, background-image, span {background-color: #00ff00} span {background-image: url('bg.gif');} Page Layout Layout Properties Each HTML element defines a layer (rectangular box) that is placed in some location on the page Layers are nested with correspondence to the nesting of their elements Inline vs. Block Elements Positioning Elements There are two type of elements: Block elements: p, ol, table, div, h1, etc. Inline elements: b, i, a, span, cite, etc. Layers of block elements are separated from their adjacent elements (i.e., a new line before and after), while inline elements are not You can turn a block into an inline and vice-versa (highly useful for img elements, among others), using the display property, e.g., h1 { display: inline } 23 Using CSS, you can define the position of an element inside its parent layer For that, use the properties position, left, right, top and bottom span { position:relative; left: 1cm; top: 1cm; distance from left color: #00cc00;} distance from top 24 4

5 Position Types Position Examples But 1cm left to what?? For that, we have the position property Four position types are supported: - static: the default position - relative: relative to the static position - absolute: relative to the parent layer coordinates - fixed: relative to the window coordinates (remains at span { position:absolute; left: 1cm; top: 1cm; color: #00cc00;} span { position:fixed; left: 1cm; top: 1cm; color: #00cc00;} the same position regardless of scrolling) Position Examples More Layout Properties Totally Ignored! span { position:static; left: 1cm; top: 1cm; color: #00cc00;} This is the default position type Layer properties - margin-top (-bottom, -left, -right) - padding-top (-bottom, -left, -right) - border-width (-color, -style, ) Text Layout The space around elements. Could be negative The space between the element borders and the element content. - direction, word-spacing, white-space, letterspacing, text-align, text-indent, Open joke1.html Length Units CSS has several types of length units: em is the distance between the bottom of one row and the next (something like a grid size). - em, ex: height of current fonts (ex is the x-height) - px, in, cm, mm, pt, pc: international units - %: ratio of parent s respective dimension the height of a lowercase x. A page should remain a proper layout when fonts and/or windows are resized (usually by the user) - Hence, do not assume anything about default sizes Selector Types

6 Several Kinds of Selectors Type Selector Type Selectors Class Selectors ID Selectors A type selector is the name of an element type A type selector matches every instance of the Attribute Selectors Universal Selector Child Selectors Adjacent-Sibling Selectors Descendant Selectors Pseudo-Class Selectors Pseudo-Element Selectors Not supported by IE 5, 5.5 and 6. The good news (to us): supported by IE 7 The bad news (to others): can no longer be used to hide CSS code from IE 31 element type li {color: red; font-size: 16px} Matches: <ol> <li> An item </li> <li class="reditem"> Another item </li> </ol> 32 Universal Selector The universal selector matches every element The following rule means that all the text will have a size of 40px * {font-size: 40px } Attribute Selectors p[title] - matches p when its title attribute is set to any value p[title=intro] or p[title="intro"] (the quotes are optional) - matches p when its title attribute is set to intro p[class~=green] - matches p when the class attribute value includes the word green Class Selector ID Selectors A class selector is a selector of the form x.y It matches xs that have the class attribute with value y (i.e., it is a shorthand for x[class=y]) li.reditem {color: red} Matches:.reditem {color: red} will <ol> also work! (it will match any element <li> An item </li> with class="reditem ) <li class="reditem"> Another item </li> </ol> 35 IDs are similar to classes, except that there can only be one element with a given ID in a document That is, an ID is unique per element li#23 {color: red} Matches: <ol> <li> An item </li> <li id="23"> Another item </li> </ol> #23 { color: red} will also work! 36 6

7 Descendant/Child/Sibling Selector emphasized text An Example A descendant selector has the form S 1 S 2 where S 1 and S 2 are (possible complex) selectors It matches all elements that - match S 2, and - are descendants (nested in any level in) elements that match S 1 To match only immediate descendants (children), use a Child Selector which has the form S 1 >S 2 To match S 2 immediately following S 2, use an Adjacent p em {color: blue} Matches: This is <em>not blue</em>. <p> This is <em> blue </em> <span><i>and so is <em> this </em></i></span>. </p> What will this match? Sibling Selectore which has the form S 1 +S 2.href div>span em {color: blue} Pseudo-Classes Examples of Rules for Pseudo-Classes Pseudo class selectors are similar to class a:link {color: blue} selectors, but they match states rather than class values - For example, a link can be in the states: visited, active, mouse-over ( hover ), etc. - Another example: a text-area can be focused 39 a:visited {color: purple} a:hover {font-size: 1.5em} a:active{color: red} input[type=text]:focus {background-color: yellow} when typing a text into a text input box (meaningful with other input types as well) 40 Pseudo-Elements Grouping Selectors Pseudo element selectors select abstract elements which are not specified as elements in the source HTML. - For example, to transform the first line of every p into uppercase, use: P:first-line {text-transform: uppercase} Why can t this be faked by enclosing the first line with a span? The definition of first line might change, for example, if the user resizes the window 41 We can group several declarations by specifying several selectors, separated by commas For example, the following rule applies to all elements that match either h1, p b, or h2[class=largehead] p b, h1, h2.largehead {font-size: 120%} 42 7

8 Inline Styles Inserting Style to a Page In an inline style, the declaration block is the value of the attribute style of the element <p style="color: green; font-size: 1.5em; font-style: italic"> This text will be shown in italic green and the size will be 1.5 times the current font size </p> 43 Almost every tag can have the style attribute - exceptional: base, head, html, meta, param, script, style and title 44 Document-Level Style Imported Style Sheets <html> <head> <style type="text/css"> rule imports the style rules of another style sheet body {color: red; background: skyblue;} url(file.css) h1 { color: blue } </style> Several import rules may appear at the beginning of the style sheet </head> <body>... </body> Import rules can appear in embedded style sheets or in external style sheets </html> Imported Style Sheets An url(general.css); body { color: red;background:skyblue } h1 { color: blue } Inheritance and Cascading Why do we need the import command when we have the <link> tag? in a css file, one can create stylesheets which are based on others

9 Inheritance of Properties Consider a property of an element that does not match any rule For some properties (inherited properties), the computed value of this property is inherited from the parent of the element For example, color, font and word-spacing are inherited Number of white spaces between words Yet border, margin and padding are not! An Example Given the rules: - body { font-size: 10pt } Computed Value: 12pt - h1 { font-size: 120% } What will be the font size of the <em> element? <body> <h1>a <em>large</em> heading</h1> </body> Cascading of Styles CSS merges style rules from different places (inline, document-level, linked and defaults) Different places may have conflicting style rules - conflicts may even arise in a single source The process of merging (cascading) styles from different places determines which style rules have higher priority Determining Property Values Suppose that we would like to determine the value of property p for element e Choose all declarations that have a selector that matches e and have the property p Sort all declarations according to cascading order Choose the first declaration in the cascading order, and apply the corresponding rule Cascading Order Importance of Origin The cascading order of declarations: 1. Primary sort: importance of origin 2. Secondary sort: specificity of selectors 3. Final sort: order of appearance 53 There are two rule origins: author and browser (either defaults or user customizations) strongest weakest browser!important rules author!important rules author rules browser rules For example, you can add stylesheets to IE in the following way: Tools internet options Accessibility User style sheet. Of course you can add!important browser rules this way as well 54 9

10 strongest weakest Specificity of Selectors is rule in style attribute? number of ID attributes number of attributes and pseudo-classes number of element names An Example Consider the following rules: - li { } - #x34y { } - ul ol li.red { } Which is the most specific? li.red is a descendent of ol, which is a descendant of ul Order of Appearance If two rules have the same origin importance and specificity, then the one that appears last in the style sheet overrides the others Rules in imported style sheets (@import) are considered to appear before local rules 57 10

CSS. https://developer.mozilla.org/en-us/docs/web/css

CSS. https://developer.mozilla.org/en-us/docs/web/css CSS https://developer.mozilla.org/en-us/docs/web/css http://www.w3schools.com/css/default.asp Cascading Style Sheets Specifying visual style and layout for an HTML document HTML elements inherit CSS properties

More information

CSS: The Basics CISC 282 September 20, 2014

CSS: The Basics CISC 282 September 20, 2014 CSS: The Basics CISC 282 September 20, 2014 Style Sheets System for defining a document's style Used in many contexts Desktop publishing Markup languages Cascading Style Sheets (CSS) Style sheets for HTML

More information

CSS Cascading Style Sheets

CSS Cascading Style Sheets CSS Cascading Style Sheets site root index.html about.html services.html stylesheet.css images boris.jpg Types of CSS External Internal Inline External CSS An external style sheet is a text document with

More information

CSS Selectors. element selectors. .class selectors. #id selectors

CSS Selectors. element selectors. .class selectors. #id selectors CSS Selectors Patterns used to select elements to style. CSS selectors refer either to a class, an id, an HTML element, or some combination thereof, followed by a list of styling declarations. Selectors

More information

Cascading Style Sheets (CSS)

Cascading Style Sheets (CSS) Cascading Style Sheets (CSS) Mendel Rosenblum 1 Driving problem behind CSS What font type and size does introduction generate? Answer: Some default from the browser (HTML tells what browser how)

More information

BIM222 Internet Programming

BIM222 Internet Programming BIM222 Internet Programming Week 7 Cascading Style Sheets (CSS) Adding Style to your Pages Part II March 20, 2018 Review: What is CSS? CSS stands for Cascading Style Sheets CSS describes how HTML elements

More information

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB Unit 3 Cascading Style Sheets (CSS) Slides based on course material SFU Icons their respective owners 1 Learning Objectives In this unit you

More information

Creating and Building Websites

Creating and Building Websites Creating and Building Websites Stanford University Continuing Studies CS 21 Mark Branom branom@alumni.stanford.edu Course Web Site: http://web.stanford.edu/group/csp/cs21 Week 6 Slide 1 of 28 Week 6 Agenda

More information

<body bgcolor=" " fgcolor=" " link=" " vlink=" " alink=" "> These body attributes have now been deprecated, and should not be used in XHTML.

<body bgcolor=  fgcolor=  link=  vlink=  alink= > These body attributes have now been deprecated, and should not be used in XHTML. CSS Formatting Background When HTML became popular among users who were not scientists, the limited formatting offered by the built-in tags was not enough for users who wanted a more artistic layout. Netscape,

More information

Assignments (4) Assessment as per Schedule (2)

Assignments (4) Assessment as per Schedule (2) Specification (6) Readability (4) Assignments (4) Assessment as per Schedule (2) Oral (4) Total (20) Sign of Faculty Assignment No. 02 Date of Performance:. Title: To apply various CSS properties like

More information

3.1 Introduction. 3.2 Levels of Style Sheets. - The CSS1 specification was developed in There are three levels of style sheets

3.1 Introduction. 3.2 Levels of Style Sheets. - The CSS1 specification was developed in There are three levels of style sheets 3.1 Introduction - The CSS1 specification was developed in 1996 - CSS2 was released in 1998 - CSS2.1 reflects browser implementations - CSS3 is partially finished and parts are implemented in current browsers

More information

- The CSS1 specification was developed in CSS2 was released in CSS2.1 reflects browser implementations

- The CSS1 specification was developed in CSS2 was released in CSS2.1 reflects browser implementations 3.1 Introduction - The CSS1 specification was developed in 1996 - CSS2 was released in 1998 - CSS2.1 reflects browser implementations - CSS3 is partially finished and parts are implemented in current browsers

More information

COSC 2206 Internet Tools. CSS Cascading Style Sheets

COSC 2206 Internet Tools. CSS Cascading Style Sheets COSC 2206 Internet Tools CSS Cascading Style Sheets 1 W3C CSS Reference The official reference is here www.w3.org/style/css/ 2 W3C CSS Validator You can upload a CSS file and the validator will check it

More information

Chapter 3 Style Sheets: CSS

Chapter 3 Style Sheets: CSS WEB TECHNOLOGIES A COMPUTER SCIENCE PERSPECTIVE JEFFREY C. JACKSON Chapter 3 Style Sheets: CSS 1 Motivation HTML markup can be used to represent Semantics: h1 means that an element is a top-level heading

More information

The Benefits of CSS. Less work: Change look of the whole site with one edit

The Benefits of CSS. Less work: Change look of the whole site with one edit 11 INTRODUCING CSS OVERVIEW The benefits of CSS Inheritance Understanding document structure Writing style rules Attaching styles to the HTML document The cascade The box model CSS units of measurement

More information

CSS. Selectors & Measurments. Copyright DevelopIntelligence LLC

CSS. Selectors & Measurments. Copyright DevelopIntelligence LLC CSS Selectors & Measurments 1 Back to descendants remember walking down the document tree structure and see how parents and children interact not only is it important to know about inheritance walking

More information

Introduction to Web Tech and Programming

Introduction to Web Tech and Programming Introduction to Web Tech and Programming Cascading Style Sheets Designed to facilitate separation of content and presentation from a document Allows easy modification of style for an entire page or an

More information

CSS مفاهیم ساختار و اصول استفاده و به کارگیری

CSS مفاهیم ساختار و اصول استفاده و به کارگیری CSS مفاهیم ساختار و اصول استفاده و به کارگیری Cascading Style Sheets A Cascading Style Sheet (CSS) describes the appearance of an HTML page in a separate document : مسایای استفاده از CSS It lets you separate

More information

Cascading Style Sheets Level 2

Cascading Style Sheets Level 2 Cascading Style Sheets Level 2 Course Objectives, Session 1 Level 1 Quick Review Chapter 6 Revisit: Web Fonts Chapter 8: Adding Graphics to Web Pages Chapter 9: Sprucing Up Your Site s Navigation Begin

More information

Cascading Style Sheets

Cascading Style Sheets 4 TVEZEWXYHMNR LSTVSKVEQY-RJSVQEXMOENITSHTSVSZ RETVSNIOXIQ RERGSZER Q^)ZVSTWO LSWSGM PR LSJSRHYEVS^TS XYLPEZR LSQ WXE4VEL] 4VELE)9-RZIWXYNIQIHSZE% FYHSYGRSWXM CSS Cascading Style Sheets Lukáš Bařinka barinkl@fel.cvut.cz

More information

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2)

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2) Web Development & Design Foundations with HTML5 Ninth Edition Chapter 3 Configuring Color and Text with CSS Slides in this presentation contain hyperlinks. JAWS users should be able to get a list of links

More information

Appendix D CSS Properties and Values

Appendix D CSS Properties and Values HTML Appendix D CSS Properties and Values This appendix provides a brief review of Cascading Style Sheets (CSS) concepts and terminology, and lists CSS level 1 and 2 properties and values supported by

More information

Web Information System Design No.4 Put Style to Web Documents. Tatsuya Hagino

Web Information System Design No.4 Put Style to Web Documents. Tatsuya Hagino Web Information System Design No.4 Put Style to Web Documents Tatsuya Hagino (hagino@sfc.keio.ac.jp) 1 Web Page Components Combine orthogonal technologies content style programming style JavaScript Programming

More information

Session 4. Style Sheets (CSS) Reading & References. A reference containing tables of CSS properties

Session 4. Style Sheets (CSS) Reading & References.   A reference containing tables of CSS properties Session 4 Style Sheets (CSS) 1 Reading Reading & References en.wikipedia.org/wiki/css Style Sheet Tutorials www.htmldog.com/guides/cssbeginner/ A reference containing tables of CSS properties web.simmons.edu/~grabiner/comm244/weekthree/css-basic-properties.html

More information

CSS Cascading Style Sheets

CSS Cascading Style Sheets CSS Cascading Style Sheets site root index.html about.html services.html stylesheet.css charlie.jpg Linking to your HTML You need to link to your css in the of your HTML file.

More information

- The CSS1 specification was developed in CSSs provide the means to control and change presentation of HTML documents

- The CSS1 specification was developed in CSSs provide the means to control and change presentation of HTML documents 3.1 Introduction - The CSS1 specification was developed in 1996 - CSS2 was released in 1998 - CSS3 is on its way - CSSs provide the means to control and change presentation of HTML documents - CSS is not

More information

2. Write style rules for how you d like certain elements to look.

2. Write style rules for how you d like certain elements to look. CSS for presentation Cascading Style Sheet Orientation CSS Cascading Style Sheet is a language that allows the user to change the appearance or presentation of elements on the page: the size, style, and

More information

8a. Cascading Style Sheet

8a. Cascading Style Sheet INFS 2150 Introduction to Web Development 8a. Cascading Style Sheet 1 Objectives Concepts of cascading style sheets (CSS). 3 ways of using CSS: inline styles, embedded styles, and external style sheet.

More information

ITNP43: HTML Lecture 4

ITNP43: HTML Lecture 4 ITNP43: HTML Lecture 4 Niederst, Part III (3rd edn) 1 Style versus Content HTML purists insist that style should be separate from content and structure HTML was only designed to specify the structure and

More information

CSS. Lecture 16 COMPSCI 111/111G SS 2018

CSS. Lecture 16 COMPSCI 111/111G SS 2018 CSS Lecture 16 COMPSCI 111/111G SS 2018 No CSS Styles A style changes the way the HTML code is displayed Same page displayed using different styles http://csszengarden.com Same page with a style sheet

More information

HTML and CSS COURSE SYLLABUS

HTML and CSS COURSE SYLLABUS HTML and CSS COURSE SYLLABUS Overview: HTML and CSS go hand in hand for developing flexible, attractively and user friendly websites. HTML (Hyper Text Markup Language) is used to show content on the page

More information

Study Guide 2 - HTML and CSS - Chap. 6,8,10,11,12 Name - Alexia Bernardo

Study Guide 2 - HTML and CSS - Chap. 6,8,10,11,12 Name - Alexia Bernardo Study Guide 2 - HTML and CSS - Chap. 6,8,10,11,12 Name - Alexia Bernardo Note: We skipped Study Guide 1. If you d like to review it, I place a copy here: https:// people.rit.edu/~nbbigm/studyguides/sg-1.docx

More information

HTML & CSS. SWE 432, Fall 2017 Design and Implementation of Software for the Web

HTML & CSS. SWE 432, Fall 2017 Design and Implementation of Software for the Web HTML & CSS SWE 432, Fall 2017 Design and Implementation of Software for the Web HTML: HyperText Markup Language LaToza Language for describing structure of a document Denotes hierarchy of elements What

More information

CSS Lecture 16 COMPSCI 111/111G SS 2018

CSS Lecture 16 COMPSCI 111/111G SS 2018 No CSS CSS Lecture 16 COMPSCI 111/111G SS 2018 Styles Astyle changes the way the HTML code is displayed Same page displayed using different styles Same page with a style sheet body font-family: sans-serif;

More information

CSS FOUNDATIONS IN-DEPTH. The nitty-gritty of css...

CSS FOUNDATIONS IN-DEPTH. The nitty-gritty of css... CSS FOUNDATIONS IN-DEPTH The nitty-gritty of css... What is CSS? Cascading Style Sheets Style sheets define formatting rules that are applied to text, images, forms, and embedded and layout elements. A

More information

Review Question 1. Which tag is used to create a link to another page? 1. <p> 2. <li> 3. <a> 4. <em>

Review Question 1. Which tag is used to create a link to another page? 1. <p> 2. <li> 3. <a> 4. <em> Introduction to CSS Review Question 1 Which tag is used to create a link to another page? 1. 2. 3. 4. Review Question 1 Which tag is used to create a link to another page? 1. 2.

More information

Introduction to Multimedia. MMP100 Spring 2016 thiserichagan.com/mmp100

Introduction to Multimedia. MMP100 Spring 2016 thiserichagan.com/mmp100 Introduction to Multimedia MMP100 Spring 2016 profehagan@gmail.com thiserichagan.com/mmp100 Troubleshooting Check your tags! Do you have a start AND end tags? Does everything match? Check your syntax!

More information

INTRODUCTION TO CSS. Mohammad Jawad Kadhim

INTRODUCTION TO CSS. Mohammad Jawad Kadhim INTRODUCTION TO CSS Mohammad Jawad Kadhim WHAT IS CSS Like HTML, CSS is an interpreted language. When a web page request is processed by a web server, the server s response can include style sheets,

More information

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space. HTML Summary Structure All of the following are containers. Structure Contains the entire web page. Contains information

More information

CSC309 Programming on the Web week 3: css, rwd

CSC309 Programming on the Web week 3: css, rwd CSC309 Programming on the Web week 3: css, rwd Amir H. Chinaei, Spring 2017 Office Hours: M 3:45-5:45 BA4222 ahchinaei@cs.toronto.edu http://www.cs.toronto.edu/~ahchinaei/ survey 1 in survey 1, you provide

More information

Block & Inline Elements

Block & Inline Elements Block & Inline Elements Every tag in HTML can classified as a block or inline element. > Block elements always start on a new line (Paragraph, List items, Blockquotes, Tables) > Inline elements do not

More information

Client-Side Web Technologies. CSS Part I

Client-Side Web Technologies. CSS Part I Client-Side Web Technologies CSS Part I Topics Style declarations Style sources Selectors Selector specificity The cascade and inheritance Values and units CSS Cascading Style Sheets CSS specifies the

More information

DAY 4. Coding External Style Sheets

DAY 4. Coding External Style Sheets DAY 4 Coding External Style Sheets LESSON LEARNING TARGETS I can code and apply an embedded style sheet to a Web page. I can code and apply an external style sheet to multiple Web pages. I can code and

More information

<style type="text/css"> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page***

<style type=text/css> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page*** Chapter 7 Using Advanced Cascading Style Sheets HTML is limited in its ability to define the appearance, or style, across one or mare Web pages. We use Cascading style sheets to accomplish this. Remember

More information

CSS for Styling CS380

CSS for Styling CS380 1 CSS for Styling The good, the bad and the 2 ugly! shashdot. News for nerds!! You will never, ever be bored here!

More information

CSS: Formatting Text. CSS for text processing: font-family. Robert A. Fulkerson

CSS: Formatting Text. CSS for text processing: font-family. Robert A. Fulkerson CSS: Formatting Text Robert A. Fulkerson College of Information Science and Technology http://www.ist.unomaha.edu/ University of Nebraska at Omaha http://www.unomaha.edu/ CSS for text processing: font-family

More information

Deccansoft Software Services

Deccansoft Software Services Deccansoft Software Services (A Microsoft Learning Partner) HTML and CSS COURSE SYLLABUS Module 1: Web Programming Introduction In this module you will learn basic introduction to web development. Module

More information

To link to an external stylesheet, the link element is placed within the head of the html page:

To link to an external stylesheet, the link element is placed within the head of the html page: CSS Basics An external style sheet is simply a text file (use BBEdit or Textwrangler) containing style rules, saved with the.css extension. It s best practice to keep style sheets for a site grouped within

More information

Cascading Style Sheets. Overview and Basic use of CSS

Cascading Style Sheets. Overview and Basic use of CSS Cascading Style Sheets Overview and Basic use of CSS What are Style Sheets? A World Wide Web Consortium (W3C) defined standard A way for web page designers to separate the formatting of a document from

More information

EECS1012. Net-centric Introduction to Computing. Lecture 3: CSS for Styling

EECS1012. Net-centric Introduction to Computing. Lecture 3: CSS for Styling EECS1012 Net-centric Introduction to Computing Lecture 3: CSS for Styling Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M. Stepp, J. Miller, and V. Kirst.

More information

Tutorial 3: Working with Cascading Style Sheets

Tutorial 3: Working with Cascading Style Sheets Tutorial 3: Working with Cascading Style Sheets College of Computing & Information Technology King Abdulaziz University CPCS-665 Internet Technology Objectives Review the history and concepts of CSS Explore

More information

Chapter 4 CSS basics

Chapter 4 CSS basics Sungkyunkwan University Chapter 4 CSS basics Prepared by J. Lee and H. Choo Web Programming Copyright 2000-2018 Networking Laboratory 1/48 Copyright 2000-2012 Networking Laboratory Chapter 4 Outline 4.1

More information

HTML/XML. HTML Continued Introduction to CSS

HTML/XML. HTML Continued Introduction to CSS HTML/XML HTML Continued Introduction to CSS Entities Special Characters Symbols such as +, -, %, and & are used frequently. Not all Web browsers display these symbols correctly. HTML uses a little computer

More information

Cascading Style Sheet. Styles as Tag Attributes. Syntax. <h1>: what font type/size is used? STYLE = SELECTOR {RULES} Attributes such as bgcolor

Cascading Style Sheet. Styles as Tag Attributes. Syntax. <h1>: what font type/size is used? STYLE = SELECTOR {RULES} Attributes such as bgcolor Styles? Cascading Style Sheet http://www.eie.polyu.edu.hk/~nflaw/biclustering/index.html Request string: GET /~nflaw/biclustering/index.html HTTP/1.1 Host: www.eie.polyu.edu.hk 1 Response string: HTTP/1.1

More information

CSS

CSS http://www.flickr.com/photos/baylorbear78/3406180116/ CSS 2 OVERVIEW OF CSS HTML is about content and structure (semantics) What is the content? How is the content related to other content? CSS is all

More information

Unit 10 - Client Side Customisation of Web Pages. Week 5 Lesson 1 CSS - Selectors

Unit 10 - Client Side Customisation of Web Pages. Week 5 Lesson 1 CSS - Selectors Unit 10 - Client Side Customisation of Web Pages Week 5 Lesson 1 CSS - Selectors Last Time CSS box model Concept of identity - id Objectives Selectors the short story (or maybe not) Web page make-over!

More information

2005 WebGUI Users Conference

2005 WebGUI Users Conference Cascading Style Sheets 2005 WebGUI Users Conference Style Sheet Types 3 Options Inline Embedded Linked Inline Use an inline style sheet to modify a single element one time in a page.

More information

Session 3.1 Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external style sheets Understand style

Session 3.1 Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external style sheets Understand style Session 3.1 Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external style sheets Understand style precedence and style inheritance Understand the CSS use

More information

Reading 2.2 Cascading Style Sheets

Reading 2.2 Cascading Style Sheets Reading 2.2 Cascading Style Sheets By Multiple authors, see citation after each section What is Cascading Style Sheets (CSS)? Cascading Style Sheets (CSS) is a style sheet language used for describing

More information

ADDING CSS TO YOUR HTML DOCUMENT. A FEW CSS VALUES (colour, size and the box model)

ADDING CSS TO YOUR HTML DOCUMENT. A FEW CSS VALUES (colour, size and the box model) INTRO TO CSS RECAP HTML WHAT IS CSS ADDING CSS TO YOUR HTML DOCUMENT CSS IN THE DIRECTORY TREE CSS RULES A FEW CSS VALUES (colour, size and the box model) CSS SELECTORS SPECIFICITY WEEK 1 HTML In Week

More information

Adding CSS to your HTML

Adding CSS to your HTML Adding CSS to your HTML Lecture 3 CGS 3066 Fall 2016 September 27, 2016 Making your document pretty CSS is used to add presentation to the HTML document. We have seen 3 ways of adding CSS. In this lecture,

More information

Cascade Stylesheets (CSS)

Cascade Stylesheets (CSS) Previous versions: David Benavides and Amador Durán Toro (noviembre 2006) Last revision: Manuel Resinas (october 2007) Tiempo: 2h escuela técnica superior de ingeniería informática Departamento de Lenguajes

More information

CSS: Cascading Style Sheets

CSS: Cascading Style Sheets CSS: Cascading Style Sheets Computer Science and Engineering College of Engineering The Ohio State University Lecture 13 Evolution of CSS MIME type: text/css CSS 1 ('96): early recognition of value CSS

More information

CSC 443: Web Programming

CSC 443: Web Programming 1 CSC 443: Web Programming Haidar Harmanani Department of Computer Science and Mathematics Lebanese American University Byblos, 1401 2010 Lebanon CSC443: Web Programming 2 for Styling The good, the bad

More information

CSS Styles Quick Reference Guide

CSS Styles Quick Reference Guide Table 1: CSS Font and Text Properties Font & Text Properties Example(s) font-family Font or typeface font-family: Tahoma font-size Size of the font font-size: 12pt font-weight Normal or bold font-weight:

More information

INFORMATICA GENERALE 2014/2015 LINGUAGGI DI MARKUP CSS

INFORMATICA GENERALE 2014/2015 LINGUAGGI DI MARKUP CSS INFORMATICA GENERALE 2014/2015 LINGUAGGI DI MARKUP CSS cristina gena dipartimento di informatica cgena@di.unito.it http://www.di.unito.it/~cgena/ materiale e info sul corso http://www.di.unito.it/~cgena/teaching.html

More information

CSS: formatting webpages

CSS: formatting webpages CSS: formatting webpages Why CSS? separate content from formatting (style) style can be changed easily without rewriting webpages keep formatting consistent across website allows more advanced formatting

More information

Parashar Technologies HTML Lecture Notes-4

Parashar Technologies HTML Lecture Notes-4 CSS Links Links can be styled in different ways. HTML Lecture Notes-4 Styling Links Links can be styled with any CSS property (e.g. color, font-family, background, etc.). a { color: #FF0000; In addition,

More information

Cascading Style Sheets (CSS)

Cascading Style Sheets (CSS) Cascading Style Sheets (CSS) Web Architecture and Information Management [./] Spring 2009 INFO 190-02 (CCN 42509) Erik Wilde, UC Berkeley School of Information [http://creativecommons.org/licenses/by/3.0/]

More information

CSc 337 LECTURE 3: CSS

CSc 337 LECTURE 3: CSS CSc 337 LECTURE 3: CSS The bad way to produce styles welcome to Greasy Joe's. You will never, ever, ever beat our

More information

IMY 110 Theme 6 Cascading Style Sheets

IMY 110 Theme 6 Cascading Style Sheets IMY 110 Theme 6 Cascading Style Sheets 1. Cascading Style Sheets 1.1. Cascading Style Sheets Up to now we have done styling by using the style attribute. e.g. paragraph What

More information

Introduction to CSS. Fijihosting.com Introduction to CSS page 1. What are style sheets? Lovely! How do I use them?

Introduction to CSS. Fijihosting.com Introduction to CSS page 1. What are style sheets? Lovely! How do I use them? Introduction to CSS Style sheets (or to give them their full title, cascading style sheets or CSS) are becoming more and more common on the Web. They were first introduced in a limited form to Internet

More information

CSS3 Basics. From & CSS Visual Dictionary Learning Curve Books, LLC

CSS3 Basics. From   & CSS Visual Dictionary Learning Curve Books, LLC CSS3 Basics From www.w3schools.com & CSS Visual Dictionary Learning Curve Books, LLC CSS Box Model Margin (top, right, bottom, left) Shorthand property, equivalent to Border-width border-style border-color

More information

Text and Layout. Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 11. This presentation 2004, MacAvon Media Productions

Text and Layout. Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 11. This presentation 2004, MacAvon Media Productions Text and Layout Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 11 This presentation 344 345 Text in Graphics Maximum flexibility obtained by treating text as graphics and manipulating

More information

ID1354 Internet Applications

ID1354 Internet Applications ID1354 Internet Applications CSS Leif Lindbäck, Nima Dokoohaki leifl@kth.se, nimad@kth.se SCS/ICT/KTH What is CSS? - Cascading Style Sheets, CSS provide the means to control and change presentation of

More information

Zen Garden. CSS Zen Garden

Zen Garden. CSS Zen Garden CSS Patrick Behr CSS HTML = content CSS = display It s important to keep them separated Less code in your HTML Easy maintenance Allows for different mediums Desktop Mobile Print Braille Zen Garden CSS

More information

Web Engineering CSS. By Assistant Prof Malik M Ali

Web Engineering CSS. By Assistant Prof Malik M Ali Web Engineering CSS By Assistant Prof Malik M Ali Overview of CSS CSS : Cascading Style Sheet a style is a formatting rule. That rule can be applied to an individual tag element, to all instances of a

More information

Web Site Design. Stanford University Continuing Studies CS 03. Mark Branom

Web Site Design. Stanford University Continuing Studies CS 03. Mark Branom Web Site Design Stanford University Continuing Studies CS 03 Mark Branom branom@alumni.stanford.edu http://web.stanford.edu/people/markb/ Course Web Site: http://web.stanford.edu/group/csp/cs03 Week 5

More information

Tutorial 4: Creating Special Effects with CSS

Tutorial 4: Creating Special Effects with CSS Tutorial 4: Creating Special Effects with CSS College of Computing & Information Technology King Abdulaziz University CPCS-403 Internet Applications Programming Objectives Work with CSS selectors Create

More information

CASCADING STYLESHEETS

CASCADING STYLESHEETS CASCADING STYLESHEETS Cascading StyleSheets (CSS) has been mainly created because HTML is just not the right tool for precision and flexibility. HTML is not a very effective for designing web pages. Most

More information

3.1 Introduction. 3.2 Levels of Style Sheets. - HTML is primarily concerned with content, rather than style. - There are three levels of style sheets

3.1 Introduction. 3.2 Levels of Style Sheets. - HTML is primarily concerned with content, rather than style. - There are three levels of style sheets 3.1 Introduction - HTML is primarily concerned with content, rather than style - However, tags have presentation properties, for which browsers have default values - The CSS1 cascading style sheet specification

More information

INTERNATIONAL UNIVERSITY OF JAPAN Public Management and Policy Analysis Program Graduate School of International Relations

INTERNATIONAL UNIVERSITY OF JAPAN Public Management and Policy Analysis Program Graduate School of International Relations Hun Myoung Park (1/26/2019) Cascading Style Sheets: 1 INTERNATIONAL UNIVERSITY OF JAPAN Public Management and Policy Analysis Program Graduate School of International Relations ADC5030401 (2 Credits) Introduction

More information

Networks and Web for Health Informatics (HINF 6220) Tutorial 8 : CSS. 8 Oct 2015

Networks and Web for Health Informatics (HINF 6220) Tutorial 8 : CSS. 8 Oct 2015 Networks and Web for Health Informatics (HINF 6220) Tutorial 8 : CSS 8 Oct 2015 What is CSS? o CSS (Style Sheet) defines how HTML elements are formatted and displayed. o It helps you easily change an HTML

More information

1/6/ :28 AM Approved New Course (First Version) CS 50A Course Outline as of Fall 2014

1/6/ :28 AM Approved New Course (First Version) CS 50A Course Outline as of Fall 2014 1/6/2019 12:28 AM Approved New Course (First Version) CS 50A Course Outline as of Fall 2014 CATALOG INFORMATION Dept and Nbr: CS 50A Title: WEB DEVELOPMENT 1 Full Title: Web Development 1 Last Reviewed:

More information

Web Development & Design Foundations with HTML5

Web Development & Design Foundations with HTML5 Web Development & Design Foundations with HTML5 KEY CONCEPTS Copyright Terry Felke-Morris 1 Learning Outcomes In this chapter, you will learn how to... Describe the evolution of style sheets from print

More information

First Name Last Name CS-081 March 23, 2010 Midterm Exam

First Name Last Name CS-081 March 23, 2010 Midterm Exam First Name Last Name CS-081 March 23, 2010 Midterm Exam Instructions: For multiple choice questions, circle the letter of the one best choice unless the question explicitly states that it might have multiple

More information

CSE 154 LECTURE 3: MORE CSS

CSE 154 LECTURE 3: MORE CSS CSE 154 LECTURE 3: MORE CSS Cascading Style Sheets (CSS): ... ... HTML CSS describes the appearance and layout of information

More information

Setting a Background Image

Setting a Background Image More CSS More CSS Features Let's take a look at some more features available to us via CSS, as well as some techniques to make our CSS declarations more precise and efficient: Setting images as the background

More information

Web Site Design and Development Lecture 5

Web Site Design and Development Lecture 5 Web Site Design and Development Lecture 5 CS 0134 Fall 2018 Tues and Thurs 1:00 2:15PM CSS CSS stands for Cascading Style Sheets. These style sheets define the look and layout of your HTML elements. A

More information

CMPT 165 Advanced XHTML & CSS Part 3

CMPT 165 Advanced XHTML & CSS Part 3 CMPT 165 Advanced XHTML & CSS Part 3 Oct 15 th, 2015 Today s Agenda Quick Recap of last week: Tree diagram Contextual selectors CSS: Inheritance & Specificity Review 1 exam question Q/A for Assignment

More information

Web Development & Design Foundations with HTML5

Web Development & Design Foundations with HTML5 1 Web Development & Design Foundations with HTML5 CHAPTER 3 CSS BASICS Copyright Terry Felke-Morris 2 Learning Outcomes In this chapter, you will learn how to... Describe the evolution of style sheets

More information

CSS. Shan-Hung Wu CS, NTHU

CSS. Shan-Hung Wu CS, NTHU CSS Shan-Hung Wu CS, NTHU CSS Zen Garden 2 Outline The Basics Selectors Layout Stacking Order 3 Outline The Basics Selectors Layout Stacking Order 4 Grammar selector { property: value; 5 Example /* for

More information

COMS 359: Interactive Media

COMS 359: Interactive Media COMS 359: Interactive Media Agenda Review CSS Preview Review Transparent GIF headline Review JPG buttons button1.jpg button.psd button2.jpg Review Next Step Tables CSS Introducing CSS What is CSS? Cascading

More information

LBS Polytechnic. Hey! Make With The Style Sheet Already, Bub!

LBS Polytechnic. Hey! Make With The Style Sheet Already, Bub! When you're all done, the format will look like this: Hey! Make With The Style Sheet Already, Bub! This

More information

Three Ways to Use CSS:

Three Ways to Use CSS: Introduction to CSS CSS Defined: Short for "Cascading Style Sheets". Determines how the elements in our XHTML documents are displayed and formatted. Designed to separate the content of a web page from

More information

IDM 221. Web Design I. IDM 221: Web Authoring I 1

IDM 221. Web Design I. IDM 221: Web Authoring I 1 IDM 221 Web Design I IDM 221: Web Authoring I 1 Week 4 IDM 221: Web Authoring I 2 Presenta(on IDM 221: Web Authoring I 3 Up until this point everything we've focused on has been related to content, and

More information

COMP519 Web Programming Lecture 7: Cascading Style Sheets: Part 3 Handouts

COMP519 Web Programming Lecture 7: Cascading Style Sheets: Part 3 Handouts COMP519 Web Programming Lecture 7: Cascading Style Sheets: Part 3 Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University

More information

COPYRIGHTED MATERIAL. Contents. Chapter 1: Creating Structured Documents 1

COPYRIGHTED MATERIAL. Contents. Chapter 1: Creating Structured Documents 1 59313ftoc.qxd:WroxPro 3/22/08 2:31 PM Page xi Introduction xxiii Chapter 1: Creating Structured Documents 1 A Web of Structured Documents 1 Introducing XHTML 2 Core Elements and Attributes 9 The

More information

Unveiling the Basics of CSS and how it relates to the DataFlex Web Framework

Unveiling the Basics of CSS and how it relates to the DataFlex Web Framework Unveiling the Basics of CSS and how it relates to the DataFlex Web Framework Presented by Roel Fermont 1 Today more than ever, Cascading Style Sheets (CSS) have a dominant place in online business. CSS

More information

Fundamentals of Web Programming a

Fundamentals of Web Programming a Fundamentals of Web Programming a Cascading Style Sheets Teodor Rus rus@cs.uiowa.edu The University of Iowa, Department of Computer Science a Copyright 2009 Teodor Rus. These slides have been developed

More information