Cascade Stylesheets (CSS)

Size: px
Start display at page:

Download "Cascade Stylesheets (CSS)"

Transcription

1 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 Grupo de Ingeniería del Software [Ángel US V7] Diseño: Amador Durán Toro ( )

2 Style and content Separating content (the information to be displayed) from style (how it is displayed) presents many advantages. It simplifies the HTML code of web pages. It promotes a homogeneous look for a web site by applying the same stylesheets to all its web pages. It expands the layout possibilities of HTML allowing an exhaustive control. It allows the presentation of the same content with different styles without modification. The semantic web Style and content separation is the first step towards the semantic web. In the semantic web, web pages will contain information about its content that will be able to be treated automatically. Sevilla, October 2009 Software Engineering Group 1

3 Style specification (example) <html> <head> </head> <body> <h1>ejemplo de CSS</h1> <p>párrafo sencillo</p> </body> </html> h1 { color: navy; font-family: sans-serif; border-bottom-width: 5; border-bottom-style: solid; border-bottom-color: blue; } p { color: olive; font-style: italic; font-size: large; } Not all browsers display styles equally Engineering Group 2

4 The CSS standard The first version of the standard, known as CSS level 1, dates from 1996 December. Later, in 1998 May the CSS level 2 specification is finally aproved. From 2005 June, the draft of CSS 2.1 is available. Since the end of 1999, CSS 3 is under development. CSS standards are available in several languages (including Spanish) in the W3C website. Engineering Group 3

5 The style attribute <html> The style of a HTML element can be specified using the style attribute. It is not recommended because it does not separate style from content. <head> </head> <body> <h1>ejemplo atributo style</h1> <p>párrafo sin estilo</p> <p style="font-family:monospace; color:red"> Párrafo con estilo </p> </body> </html> This way has the highest priority in the cascade* *After browser settings, for example setting a bigger or smaller font. Engineering Group 4

6 Internal stylesheet <html> A stylesheet can be include in a HTML header using the <style> element. Better option than using the style attribute although it does not allow reusing the styles in other pages. <head> <style type="text/css"> <!-- p {font-family:monospace; color:red} --> </style> </head> <body> <h1>ejemplo hoja interna</h1> <p>párrafo sin estilo</p> <p>párrafo con estilo</p> </body> </html> Engineering Group 5

7 External stylesheet <html> The <link> element is used in the header in order to apply an external stylesheet. It is the recommended way of applying styles since it promotes style reuse in many web pages. <head> <link rel="stylesheet" type="text/css" href="ejemplo.css" /> </head> <body> <h1>ejemplo hoja externa</h1> <p>párrafo de ejemplo</p> </body> </html> /* ejemplo.css */ h1 { } color: navy; font-family: sans-serif; border-bottom-width: 5; border-bottom-style: solid; border-bottom-color: blue; p { } color: olive; font-style: italic; font-size: large; Engineering Group 6

8 Style cascade A given element in a HTML document could have a number of associated styles. The closer or the more specific style has the precedence. If not redefined, child elements inherit their parent's style. user settings style attribute internal sheet external sheet Engineering Group 7

9 Basic syntax /* comment */ selector 1, selector 2,, selector M { } property 1 : value 1 ; /* comment */ property 2 : value 2 ; ; property N : value url(external_sheet_path.css); Selectors specify the elements the style declaration is going to be applied to. The style declaration is formed by a list of semicolon-separated property:value pairs. Some of these properties accept compound values (space-separated) or alternative values (comma-separated). Other style sheets can be imported (included). declaration C language-like comments can be used inside or outside declarations. Engineering Group 8

10 The example: <html> <head> </head> <body> <div> <h1>indice</h1> <ul> <li>item 1</li> <li><em>item</em> 2</li> </ul> <div> <h1>contenido</h1> <p>parrafo primero</p> <p>parrafo <em>segundo</em></p> </body> </html> Engineering Group 9

11 HTML elements: The style is applied to the selected elements. <html> <head> </head> <body> <div> <h1>indice</h1> <ul> <li>item 1</li> <li><em>item</em> 2</li> </ul> <div> <h1>contenido</h1> <p>parrafo primero</p> <p>parrafo <em>segundo</em> </p> </body> </html> p { text-indent: 2em; color: blue; } Engineering Group 10

12 HTML elements: The style is applied to the selected elements. <html> <head> </head> <body> <div> <h1>indice</h1> <ul> <li>item 1</li> <li><em>item</em> 2</li> </ul> <div> <h1>contenido</h1> <p>parrafo primero</p> <p>parrafo <em>segundo</em> </p> </body> </html> p { text-indent: 2em; color: blue; } h1 {color: red;} Engineering Group 11

13 HTML elements: The style is applied to the selected elements. <html> <head> </head> <body> <div> <h1>indice</h1> <ul> <li>item 1</li> <li><em>item</em> 2</li> </ul> <div> <h1>contenido</h1> <p>parrafo primero</p> <p>parrafo <em>segundo</em> </p> </body> </html> p { text-indent: 2em; color: blue; } H1 {color: red;} body {color: green;} Engineering Group 12

14 HTML elements in context: The style is applied to the elements that follow the specified parent-child relationship: <html> <head> </head> <body> <div> <h1>indice</h1> <ul> <li>item 1</li> <li><em>item</em> 2</li> </ul> <div> <h1>contenido</h1> <p>parrafo primero</p> <p>parrafo <em>segundo</em> </p> </body> </html> p em {font-weight: bolder; color: blue;} Engineering Group 13

15 HTML elements in context: The style is applied to the elements that follow the specified parent-child relationship. <html> <head> </head> <body> <div> <h1>indice</h1> <ul> <li>item 1</li> <li><em>item</em> 2</li> </ul> <div> <h1>contenido</h1> <p>parrafo primero</p> <p>parrafo <em>segundo</em> </p> </body> </html> p em {font-weight: bolder; color: blue;} li em {text-decoration: underline;} Engineering Group 14

16 The example: The attribute class allows to define one or more classes (usually one) to a HTML element. <html> <head> </head> <body> <div> <h1>indice</h1> <ul> <li class= aviso >Item 1</li> <li><em>item</em> 2</li> </ul> <div> <h1>contenido</h1> <p>parrafo primero</p> <p class= aviso >Parrafo <em>segundo</em></p> </body> </html> Engineering Group 15

17 Classes: Styles may be applied to classes. The style will be applied to any HTML element with a matching class attribute. <html> <head> </head> <body> <div> <h1>indice</h1> <ul> <li class= aviso >Item 1</li> <li><em>item</em> 2</li> </ul> <div> <h1>contenido</h1> <p>parrafo primero</p> <p class= aviso >Parrafo <em>segundo</em></p> </body> </html>.aviso { color: red; } Engineering Group 16

18 Classes: Styles may also be applied to HTML elements of an specific type. <html> <head> </head> <body> <div> <h1>indice</h1> <ul> <li class= aviso >Item 1</li> <li><em>item</em> 2</li> </ul> <div> <h1>contenido</h1> <p>parrafo primero</p> <p class= aviso >Parrafo <em>segundo</em></p> </body> </html>.aviso { color: red; } p.aviso {text-align: center;} Engineering Group 17

19 HTML elements may have an id attribute, which must be unique in the XHTML/HTML document. <html> <head> </head> <body> <div id= menu > <h1>indice</h1> <ul> <li class= aviso >Item 1</li> <li><em>item</em> 2</li> </ul> <div id= contenido > <h1>contenido</h1> <p>parrafo primero</p> <p class= aviso >Parrafo <em>segundo</em></p> </body> </html> Engineering Group 18

20 Styles can be defined for HTML elements with a specific id attribute. <html> <head> </head> <body> <div id= menu > <h1>indice</h1> <ul> <li class= aviso >Item 1</li> <li><em>item</em> 2</li> </ul> <div id= contenido > <h1>contenido</h1> <p>parrafo primero</p> <p class= aviso >Parrafo <em>segundo</em></p> </body> </html> #menu {border-style: dotted;} Engineering Group 19

21 Universal selector Universal selector: it represents any element; used for setting style properties for the whole document. * { color: green; font-size: 200% } CSS selectors: pseudoclasses Hyperlink pseudoclasses allow to specify styles for different link states. a:link for non-visited links a:active for links under processing a:visited for visited links Other pseudoclasses can be applied to any element: :hover when the mouse cursor is over the element :focus when the element has the focus (keyboard input) Engineering Group 20

22 Property values Keywords: usually used for non-numerical properties: underline, small, xxlarge, right, Lengths: they can be expressed in the following units: em: width of an "m" character in the current font ex: height of an "x" character in the current font px: pixels (screen points) in: inches (1 inch = 2.54 cm) cm, mm: centimeters, millimeters pt, pc: points (1/72 inch), picas (12 points) %: percentage relative to current size URLs: absolute or relative to the stylesheet URLs url(protocol://server:port/resource_path) url(resource_path) Colors: they can be expressed as Standard color names: red, green, blue, aqua, Hexadecimal RGB: #c0c0c0, #00ffc0, Decimal RGB: rgb(0,255,0), rgb(0%,100%,0%) Engineering Group 21

23 It is recommended: Using always relative values (%, em, ex ) Using always generic values Engineering Group 22

24 Some font properties font-family: it can be specified generically or using concrete font names. A list of fonts can be specified just in case some of them is not available. Generic names: serif, sans-serif, cursive, fantasy, monospace Concrete names: "Times New Roman", Palatino, Courier, font-size: it can be specified absolutely using values or symbols or relatively. Absolutely (values): 8pt, 10pt, 12pt, 14pt, 16pt, Absolutely (symbols): xx-small, x-small, small, medium, large, x-large, xx-large (browser font sizes). Relatively: 120% (i.e. 20% bigger than its parent's font), larger (one level up), smaller (one level down). font-style: font slant, which can be normal, italic or oblique. font-weight: font boldness, which can be normal, bold, bolder, lighter or a multiple-of-100 value between 100 and 900 (400 is the normal value). Engineering Group 23

25 Colors and Almost all HTML elements can have a foreground and a background color and/or image. Unlike other style properties, background is not inherited. Color specification As already seen, colors can be specified using color names, hexadecimal values, or decimal values ( or percentage between 0% and 100%). The 16 standard color names are the following: black = # silver = #c0c0c0 gray = # white = #ffffff maroon = # red = #ff0000 green = # lime = #00ff00 olive = # yellow = #ffff00 navy = # blue = #0000ff purple = # fuchsia = #ff00ff teal = # aqua = #00ffff Engineering Group 24

26 Some background properties background-color: element's background color; default value is transparent. background-image: image for element's background specified as a URL; default value is none. background-attachment: it specifies if the background image must move with the element (scroll, default value) o must remain fixed inside the browser window (fixed value). background-position: position of the background image inside the element's area; default position is the upper left corner. It can be specified as an offset, as a percentage of the element's area or as left, center, right, top, bottom. For example: background-position: 5px 5px; /* horizontal vertical offset */ background-position: right center; background-repeat: it specifies how the image must be repeated in order to fill all element's area. repeat: default value, it generates a mosaic. repeat-x, repeat-y: the image is repeated in one axis direction only. no-repeat: image is not repeated, i.e. it is displayed only once. Engineering Group 25

27 Some text properties text-align: element's text alignment; valid values are left (default value), right, center and justify. text-indent: it specifies the indentation of the first line of the element's text. text-decoration: it adds "decorations" to text such as underline, overline, line-through, blink or none (default value). text-transform: it specifies the case of the element's text; valid values are: capitalize (first letter in upper case), uppercase, lowercase or none. vertical-align: vertical position of the text inside the element's area; valid values are: baseline, middle, sub, super, text-top, text-bottom, top, bottom and percentages. line-height: separation between text lines; it accepts absolute values, percentages or the normal value. word-spacing: space between words; default value is normal. letter-spacing: space between letters; default value is normal. Engineering Group 26

28 Some list properties list-style-image: it specifies the URL of the image for the item marker or none if no marker is desired. list-style-position: it specifies it the item markers must be inside or outside the element's box. list-style-type: it specifies the type of marker depending on the type of list: Unordered lists (<ul>): disc, circle, square or none. Ordered lists (<ol>): decimal, lower-roman, upper-roman, lower-alpha, upperalpha or none. Other properties: properties for creating counters and for generating a specific text for an element can also be specified (see Advanced CSS). Engineering Group 27

29 Every HTML element follow a layout model based on concentric boxes. There are two types: <html> Inline boxes (em, b, span ) Block boxes (h1, p, div ) <head> </head> <body> <div id= menu > <h1>indice</h1> <ul> <li class= aviso >Item 1</li> <li><em>item</em> 2</li> </ul> <div id= contenido > <h1>contenido</h1> <p>parrafo primero</p> <p class= aviso >Parrafo <em>segundo</em></p> </body> </html> Engineering Group 28

30 An element s box Padding: Space between content and border Margin: Space between border and the next box Border Content Padding Margin Engineering Group 29

31 Content area properties height: default value is auto which is the height needed to show the element completely. width: same as height but related to element's area width. Padding and margin properties* padding-{tlbr}: padding width or auto which is usually the default value, i.e. 0. A percentage relative to content area width can also be specified. Padding area is displayed using the element's background. margin-{tlbr}: same as padding-{tlbr} but related to margins. Margins are transparent, so the background of the container element can be seen. *{tlbr} can be any of top, left, bottom, right. Engineering Group 30

32 Border properties* border-{tlbr}-color: border's color; if not specified, the foreground color of the element is used. border-{tlbr}-width: border width specified as a length or using thin, medium (default value), or thick. border-{tlbr}-style: border style, which can be one of the following values: none, dotted, dashed, solid, double, groove, ridge, inset y outset. Engineering Group *{tlbr} puede ser cualquiera de top, left, bottom, right. 31

33 The layout is made by the block boxes: Boxes are distributed vertically in the order they appear in the code. <html> <head> </head> <body> <div id= menu > <h1>indice</h1> <ul> <li class= aviso >Item 1</li> <li><em>item</em> 2</li> </ul> <div id= contenido > <h1>contenido</h1> <p>parrafo primero</p> <p class= aviso >Parrafo <em>segundo</em></p> </body> </html> Engineering Group 32

34 Boxes may float either on the left or on the right. This means: They are no longer as wide as the document. Boxes below take their place. h1 p H1 {float:left;} h1 p h1 p p p p Engineering Group 33

35 Example: #menu {float: left;} Engineering Group 34

36 clear: it specifies which sides of an element must not be adjacent to float elements; it accepts the values none (default value), left, right and both. #contenido {clear: left;} Engineering Group 35

37 Display and visibility properties display: it specifies how to display an element; it accepts the values block, inline, list-item and none. If none is specified, the element and their children is neither displayed nor taken into account for layout. visibility: it specifies an element's visibility; it accepts the values visible, hidden and collapse (for table items only). The hidden value makes the element invisible but the browser takes it into account for layout (the element's area is displayed as a hollow). Engineering Group 36

38 Other style properties There are other style properties apart from the explained: table properties, the content and counter-related properties for list items, the z-index property for ordering overlapping elements, pseudoelements as :first-letter, audio styles, printing styles, etc. W3C's validator W3C offers a validator service for CSS stylesheets in Engineering Group 37

39 Web sites about CSS Engineering Group 38

escuela técnica superior de ingeniería informática

escuela técnica superior de ingeniería informática Tiempo: 2h escuela técnica superior de ingeniería informática Previous versions: David Benavides and Amador Durán Toro (noviembre 2006) Manuel Resinas (october 2007) Last revision:pablo Fernandez, Cambios

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

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference Inline Style Syntax: Introduction to Web Design CSS Reference Example: text Internal Style Sheet Syntax: selector {property: value; Example:

More information

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference Inline Style Syntax: Introduction to Web Design CSS Reference Example: text Internal Style Sheet Syntax: selector {property: value; Example:

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

- 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

Cascading Style Sheet Quick Reference

Cascading Style Sheet Quick Reference Computer Technology 8/9 Cascading Style Sheet Quick Reference Properties Properties are listed in alphabetical order. Each property has examples of possible values. Properties are not listed if they are

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

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

- HTML is primarily concerned with content, rather than style. - However, tags have presentation properties, for which browsers have default values

- HTML is primarily concerned with content, rather than style. - However, tags have presentation properties, for which browsers have default values 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

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

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

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

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

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

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

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

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

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

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

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

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

Controlling Appearance the Old Way

Controlling Appearance the Old Way Webpages and Websites CSS Controlling Appearance the Old Way Older webpages use predefined tags - - italic text; - bold text attributes - Tables (and a few other elements) use specialized

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

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

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

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 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

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

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

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

<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

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

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

UNIVERSITI TEKNOLOGI MALAYSIA TEST 1 SEMESTER II 2012/2013

UNIVERSITI TEKNOLOGI MALAYSIA TEST 1 SEMESTER II 2012/2013 UNIVERSITI TEKNOLOGI MALAYSIA TEST 1 SEMESTER II 2012/2013 SUBJECT CODE : SCSV1223 (Section 05) SUBJECT NAME : WEB PROGRAMMING YEAR/COURSE : 1SCSV TIME : 2.00 4.00 PM DATE : 18 APRIL 2013 VENUE : KPU 10

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

Introduction to Cascading Style Sheets

Introduction to Cascading Style Sheets Introduction to Cascading Style Sheets Welcome to the CSS workshop! Before you begin this workshop you should have some basic understanding of HTML and building web pages. What is CSS anyway and what will

More information

GoSquared Equally Rounded Corners Equally Rounded Corners -webkit-border-radius -moz-border-radius border-radius Box Shadow Box Shadow -webkit-box-shadow x-offset, y-offset, blur, color Webkit Firefox

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

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

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

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

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

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

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

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

HTML-5.com itemscopehttp://data-vocabulary.org/breadcrumb<span itemprop="title">html 5</span> itemscopehttp://data-vocabulary.

HTML-5.com itemscopehttp://data-vocabulary.org/breadcrumb<span itemprop=title>html 5</span> itemscopehttp://data-vocabulary. HTML-5.com HTML-5.com is an HTML User's Guide and quick reference of HTML elements and attributes for web developers who code HTML web pages, not only for HTML 5 but for HTML coding in general, with demos

More information

Web Design and Development Tutorial 03

Web Design and Development Tutorial 03 Table of Contents Web Design & Development - Tutorial 03... 2 Using and Applying CSS to XHTML... 2 Conventions... 2 What you need for this tutorial... 2 Common Terminology... 3 Parent / Child Elements...

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

Admin. Midterm 1 on. Oct. 13 th (2 weeks from today) Coursework:

Admin. Midterm 1 on. Oct. 13 th (2 weeks from today) Coursework: Midterm 1 on Admin Oct. 13 th (2 weeks from today) Coursework: E1 grade released: please see Karoon (TA) at his office hours (Tues at 12-1pm) E2 due tomorrow E3 posted yesterday; due this Friday 11:59pm

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

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

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

Web Site Design and Development Lecture 6

Web Site Design and Development Lecture 6 Web Site Design and Development Lecture 6 CS 0134 Fall 2018 Tues and Thurs 1:00 2:15PM Inheritance Before we talk about font properties, it needs to be known that font properties are inherited by the descendants

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

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

**Method 3** By attaching a style sheet to your web page, and then placing all your styles in that new style sheet.

**Method 3** By attaching a style sheet to your web page, and then placing all your styles in that new style sheet. CSS Tutorial Part 1: Introduction: CSS adds style to tags in your html page. With HTML you told the browser what things were (e.g., this is a paragraph). Now you are telling the browser how things look

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

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

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

ITNP43: HTML Lecture 5

ITNP43: HTML Lecture 5 ITNP43: HTML Lecture 5 1 The Box Model Every HTML element (e.g. h2, p etc) lies within a virtual box: Margin area LEFT TOP This is just some text that flows onto two lines. Border RIGHT Padding area BOTTOM

More information

CSS Tutorial Part 1: Introduction: A. Adding Style to a Web Page (3 options):

CSS Tutorial Part 1: Introduction: A. Adding Style to a Web Page (3 options): CSS Tutorial Part 1: Introduction: CSS adds style to tags in your html page. With HTML you told the browser what things were (e.g., this is a paragraph). Now you are telling the browser how things look

More information

CMPT 165: More CSS Basics

CMPT 165: More CSS Basics CMPT 165: More CSS Basics Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University October 14, 2011 1 The Favorites Icon The favorites icon (favicon) is the small icon you see

More information

Welcome Please sit on alternating rows. powered by lucid & no.dots.nl/student

Welcome Please sit on alternating rows. powered by lucid & no.dots.nl/student Welcome Please sit on alternating rows powered by lucid & no.dots.nl/student HTML && CSS Workshop Day Day two, November January 276 powered by lucid & no.dots.nl/student About the Workshop Day two: CSS

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

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

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

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

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

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

By Ryan Stevenson. Guidebook #3 CSS

By Ryan Stevenson. Guidebook #3 CSS By Ryan Stevenson Guidebook #3 CSS Table of Contents 1. How to Use CSS 2. CSS Basics 3. Text Sizes Colors & Other Styling 4. Element Layout Positioning & Sizing 5. Backgrounds & Borders How to Use CSS

More information

Outline. Link HTML With Style Sheets &6&7XWRULDO &66 ;+70/ (GZDUG;LD

Outline. Link HTML With Style Sheets &6&7XWRULDO &66 ;+70/ (GZDUG;LD &6&7XWRULDO &66 ;+70/ (GZDUG;LD Outline CSS Link XHTML With Style Sheets, Class/ID selectors, Pseudo-class/element, Color values, Length units, Text, Font, Lists, Padding/border/margin, Floating/clearing,

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

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

Introduction to CSS (CSS2) Cascading Style Sheets. CSS Example. CSS Rules

Introduction to CSS (CSS2) Cascading Style Sheets. CSS Example. CSS Rules Introduction to CSS (CSS2) Cascading Style Sheets A style sheet is a collection of formatting rules that can be applied to multiple HTML documents it acts as a template, allows the same look for each occurrence

More information

HTML (Hyper Text Markup Language) CSS. (Cascading Style Sheets) HTML: problems with styles. HTML: styles. CSS: specifications.

HTML (Hyper Text Markup Language) CSS. (Cascading Style Sheets) HTML: problems with styles. HTML: styles. CSS: specifications. CSS (Cascading Style Sheets) Antonio Lioy < lioy@polito.it it > english version created by Marco D. Aime < m.aime@polito.it > Politecnico di Torino Dip. Automatica e Informatica HTML (Hyper Text Markup

More information

CSS. (Cascading Style Sheets) HTML (Hyper Text Markup Language) HTML: styles. 07/07/2011(mar'09) A.Lioy - Politecnico di Torino ( ) F.

CSS. (Cascading Style Sheets) HTML (Hyper Text Markup Language) HTML: styles. 07/07/2011(mar'09) A.Lioy - Politecnico di Torino ( ) F. CSS (Cascading Style Sheets) Antonio Lioy < lioy@polito.it it > english version created by Marco D. Aime < m.aime@polito.it > Politecnico di Torino Dip. Automatica e Informatica HTML (Hyper Text Markup

More information

Creating A Website - Part 1: Web Design principles, HTML & CSS. CSS Color Values. Hexadecimal Colors. RGB Color

Creating A Website - Part 1: Web Design principles, HTML & CSS. CSS Color Values. Hexadecimal Colors. RGB Color Notes Week 3 By: Marisa Stoolmiller CSS Color Values With CSS, colors can be specified in different ways: Color names Hexadecimal values RGB values HSL values (CSS3) HWB values (CSS4) Hexadecimal Colors

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

Page Layout. 4.1 Styling Page Sections 4.2 Introduction to Layout 4.3 Floating Elements 4.4 Sizing and Positioning

Page Layout. 4.1 Styling Page Sections 4.2 Introduction to Layout 4.3 Floating Elements 4.4 Sizing and Positioning Page Layout contents of this presentation are Copyright 2009 Marty Stepp and Jessica Miller 4.1 Styling Page Sections 4.2 Introduction to Layout 4.3 Floating Elements 4.4 Sizing and Positioning 2 1 4.1

More information

1 of 7 11/12/2009 9:29 AM

1 of 7 11/12/2009 9:29 AM 1 of 7 11/12/2009 9:29 AM Home Beginner Tutorials First Website Guide HTML Tutorial CSS Tutorial XML Tutorial Web Host Guide SQL Tutorial Advanced Tutorials Javascript Tutorial PHP Tutorial MySQL Tutorial

More information

Anatomy of a Style. Cascaded Style Sheets - CSS. CSS Presentation Description Language. Measurement Specification

Anatomy of a Style. Cascaded Style Sheets - CSS. CSS Presentation Description Language. Measurement Specification CSS Presentation Description Language HTML3:(Hyper Text Markup Language) 1990 Interpreted Language by Web Browser Describes both the structure and format of document XHTML and HTML5 Extensible Hyper Text

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

Cascading Style Sheets CSCI 311

Cascading Style Sheets CSCI 311 Cascading Style Sheets CSCI 311 Learning Objectives Learn how to use CSS to style the page Learn to separate style from structure Styling with CSS Structure is separated from style in HTML5 CSS (Cascading

More information

CSS. (Cascading Style Sheets)

CSS. (Cascading Style Sheets) CSS (Cascading Style Sheets) Antonio Lioy < lioy@polito.it > english version created by Marco D. Aime < m.aime@polito.it > Politecnico di Torino Dip. Automatica e Informatica HTML (Hyper Text Markup Language)

More information

CSS: Cascading Style Sheets

CSS: Cascading Style Sheets 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

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

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

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

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

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

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

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

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

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

The building block of a CSS stylesheet. A rule consists of a selector and a declaration block (one or more declarations).

The building block of a CSS stylesheet. A rule consists of a selector and a declaration block (one or more declarations). WDI Fundamentals Unit 4 CSS Cheat Sheet Rule The building block of a CSS stylesheet. A rule consists of a selector and a declaration block (one or more declarations). Declaration A declaration is made

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: Layout Part 2. clear. CSS for layout and formatting: clear

CSS: Layout Part 2. clear. CSS for layout and formatting: clear CSS: Layout Part 2 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 layout and formatting: clear

More information

CSCB20 Week 7. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017

CSCB20 Week 7. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017 CSCB20 Week 7 Introduction to Database and Web Application Programming Anna Bretscher Winter 2017 Cascading Style Sheets (CSS) Examples of CSS CSS provides a powerful and stillevolving toolkit of style

More information