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

Size: px
Start display at page:

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

Transcription

1 CSS (Cascading Style Sheets) Antonio Lioy < it > english version created by Marco D. Aime < > Politecnico di Torino Dip. Automatica e Informatica HTML (Hyper Text Markup Language) page description language textual description (text file) specification through commands (tags) interpreted by browsers HTML files include three types of commands: the text of the document to be visualised a logical subdivision of the document in parts (headings, paragraphs,...) hints on the graphical presentation of the document (formatting, i.e. the visualization style) HTML: styles the tags were originally intended to represent the logical content of the document rather than the formatting (which is left to the browser) <h1> means this is a first-level heading <p> means here a new paragraph starts and so on new tags were later added to manage formatting (e.g. <font>), independently from logical components (heading, paragraph, table, ) HTML: problems with styles creating Web sites with a clean separation between content and formatting rules has become more and more difficult sites have become large and complex sets of pages, which should provide an homogeneous graphical appearance formatting rules applied in the wild make maintaining sites extremely awkward Solution: CSS Cascading Style Sheets first introduced by the World Wide Web Consortium (W3C) in the HTML 4.0 standard, and now used also with XHTML and XML the style sheets describe how to visualise the logical components of the document: the first-level title the page background they enforce a strong separation between the content and the presentation format CSS: specifications CSS1 (December 1996) 50 properties CSS2 (May 1998) e CSS2.1 (July 2007) w3 (several errors) add 70 new properties to CSS1 (media-specific style-sheet e.g. for printers and sound devices downloadable fonts, tables, element positioning) CSS3 under development A.Lioy - Politecnico di Torino ( ) F.1

2 CSS home page at W3C CSS: resources tutorials and other resources automatic validation service CSS CSS descriptions are normally saved in text files external to the HTML document files with.css extension CSS files are referenced inside the head of the HTML document the same CSS file is usually included by several HTML pages it is possible to change the appearance of an entire site by modifying a single file! possible but not recommended to define the style in-line: for a single file, for single tags CSS syntax the CSS syntax includes three components: selectors, properties, and values selector { property : value ;... } the selector is the name of a tag, of a class ( class attribute), or a unique identifier ( id attribute) tag_name [ tag_name ].class [ tag_name ]:pseudo-class #unique_id the tag name can be omitted (or set to * ) to specify any tag CSS syntax - examples /* tag */ body { background-color: gray } p { font-family: "sans serif" } /* tag.class */ p.centered { text-align: center; color: green } /* class */.warning { color: red } /* tag list */ h1, h2, h3 {color: green } /* tag:pseudo-class */ a:hover { background: aqua } /* #id */ #footer { font-style: italic } Hierarchical view of HTML... <body> <h1>the kings of Rome</h1> <p>the first three kings:</p> <ul> <li>romolo</li> <li>numa Pompilio</li> <li>tullo Ostilio</li> </ul> </body> siblings first child body object hierarchy h1 p ul li li li Hierarchical inheritance properties assigned to an element are automatically inherited by his descendants it is then possible to specify a different style for a descendant the most specific rule is applied to set the font type for a page, it is better to specify a style for the BODY element rather than for every specific element exceptions: background, borders, dimensions, A.Lioy - Politecnico di Torino ( ) F.2

3 Hierarchical selectors it is possible to specify hierarchical selectors to constrain the application of some property to some specific nesting E1 E2 element E2 when descends from E1 E1 > E2 element E2 when child of E1 E1 + E2 element E2 when immediately preceded by E1 as sibling E:first-child element E when it is the first child of its parent Conditional selectors E [ A ] element E with any value assigned to the attribute A E [ A="Val"] element E with the value Val assigned to the attribute A E : lang(l) element E in the language L (e.g. "it", "de", "fr", "enuk") E : focus element E when holds the focus (e.g. a field for inserting text is active) CSS comments same syntax as the C language, i.e. /* */ /* this is a comment */ p { text-align: center; /* this is another comment */ color: red } Referring to style sheets (link tag) every HTML page using a given style sheet must include its name inside the section with the tag <link rel="stylesheet" > the user agent reads the definitions included in the file (after downloading it) and formats the page accordingly <link rel="stylesheet" type="text/css" href="polito.css"> <title>... Internal style sheets you can define a style directly inside the section with the <style> tag not recommended since you lose the advantage of sharing the style among multiple pages useful only for testing (then move the style to an external file) <style type="text/css"> body { background-color : gray } </style>... For old browsers... browsers ignore unknown tags, but visualise their content if not commented new browsers ignore the comment symbols (since style sheet comments are different) <style type="text/css"> <!-- body {background-color: gray } --> </style> A.Lioy - Politecnico di Torino ( ) F.3

4 Style for single tags (in-line style) when a full CSS is not necessary, it is recommended to use anyway the CSS syntax with the STYLE attribute in specific tags <!-- old HTML --> Prof. Antonio <b>lioy</b> Multiple definitions (cascading) in case multiple style definitions apply to the same element, the browser computes the element style by considering all the definitions in cascade, with the following priorities: tag setting (highest priority) internal style sheet external style sheet (lowest priority) <!-- CSS-like --> Prof. Antonio <span style="font-weight:bold">lioy</span> Multiple definitions: example an external stylesheet linked to the page includes the following definition: h1 {color: red; text-align: left} while an internal stylesheet includes: h1 {text-align: right} the resulting definition, used by the browser for <h1>, will be: color: red text-align: right Media-type it is possible to specify that a stylesheet applies only when the page is visualised on a specific media (or "media-type"): parameter "media= " inside the LINK tag possible to list multiple media-type parameters, separated by commas <link rel="stylesheet" type="text/css" href="polito_print_a4.css" media="print">... Supported media-types defined in CSS-2.1 all braille (Braille tactile device) embossed (Braille page printer) handheld (= small screen, limited bandwidth) print (page printer, pre-print view) projection screen speech (in CSS2 was "aural") tty (line printer; do not use "px") tv (=low resolution + audio) Media-type and media-group media-type media group paged, continuous visual, audio, speech, tactile grid, bitmap static, interactive braille continuous tactile grid both embossed paged tactile grid static handheld both visual, audio, grid, both speech bitmap print paged visual bitmap static projection paged visual bitmap interactive screen continuous visual, audio bitmap both speech continuous speech N/A both tty continuous visual grid both tv both visual, audio bitmap both A.Lioy - Politecnico di Torino ( ) F.4

5 Including a style sheet (@import) a CSS can import rules from another CSS, either unconditionally or conditionally to the media-type url ("URI_CSS") [ media1, media2,... ] ; to be inserted before any formatting rule example (inside a CSS url("poli_print.css") print; body { color: blue }... CSS: definition of the class attribute different styles can be defined for the same HTML element by using the class attribute examples: a normal paragraph, left-aligned a citation paragraph, centered and italic a centered class, to be used in place of <center> p.normal { text-align: left } p.citation { text-align: center; font-style: italic } /* not recommended: not a logical class */.centered { text-align: center } HTML: using the class attribute <p class="normal"> The poet wrote: </p> <p class="citation"> Nel mezzo del cammin di nostra vita... </p> The poet wrote: Nel mezzo del cammin di nostra vita... CSS: units relative: "em" = height of the letter "M" in the current font "ex" = height of the letter "x" in the current font "px" = pixel size absolute: "in" = inch (25.4 mm) "cm" or "mm" "pt" = typographic point (1/72 of an inch) "pc" = pica (12 pt) NOTE: "em" and "ex" are referred to the parent font if used to define font sizes CSS: colors some pre-defined colors can be accessed by name: Black, White, Gray, Silver, Yellow, Red, Purple, Fuchsia, Maroon, Green, Lime, Olive, Aqua, Teal, Blue, Navy other colors can be specified by their RGB code, hexadecimal / decimal/ percentage examples (equivalent to "red"): rgb (255, 0, 0) rgb (100%, 0%, 0%) #ff0000 #f00 /* abbreviation for two repeated hex digits*/ N.B. same names of HTML but different RGB format CSS: background (I) background-color: color inherit transparent "transparent" is default background-image: url("image_uri") image URL you should specify also a color, to be used: when failing to download the image for surrounding the image shown in correspondence to images s transparencies A.Lioy - Politecnico di Torino ( ) F.5

6 CSS: background (II) background-repeat: repeat repeat-x repeat-y no-repeat inherit multiple copies of the image to span either the entire background, or only horizontally, or only vertically background-position: position_h position_v every position can be either a keyword, or a distance (from the top-left corner), or a percentage (of the container total size) keyword (horizontal): left, center, right keyword (vertical): top, center, bottom when there is only one keyword, the second is assumed to be equal to "center" CSS: background (III) background-attachment: fixed scroll inherit the image is fixed, or follows the scrolling of the content background: color image_uri repeat attachment position inherit shorthand notation for the various specifications the order is not relevant since every element has a different syntax (elements may also be omitted) example (gray background, centered image, follows the content) background: gray url("polito_logo.jpg") scroll center center no-repeat color: color CSS: text properties (I) text-align: left right center justify text-transform: none capitalize uppercase lowercase text-decoration: none underline overline linethrough blink text-indent: length percentage negative values are possible (the text is moved to the left) CSS: text properties (II) line-height: normal multiplier length percentage the multiplier value is inherited as it is for the percentage, the resulting value is inherited examples: { line-height: 1.2; font-size: 10pt } = for the height of their rows, children inherit a multiplier of 1.2 to be applied to the size of their font { line-height: 120%; font-size: 10pt } = for the height of their rows, children inherit a fixed value of 12pt CSS: font properties (I) font-style: normal italic oblique NOTE: oblique is slightly different from italic font-weight: normal bold the numeric value identifies the black saturation font-variant: normal small-caps font-stretch: ultra-condensed extra-condensed condensed semi-condensed normal semi-expanded expanded extra-expanded ultra-expanded rarely supported by UAs CSS: font properties (II) font-size: font_size absolute value (pt, mm, ) relative value (em, ex, ) percentage absolute value (1 7, normal=3) or relative (+/ N) xx-small x-small small medium large x-large xx-large (note that there is no normal and no specific scale) notes: relative values and percentages are referred to the font of the parent element (may be the UA default) prefer relative and percentage values, avoid absolute ones A.Lioy - Politecnico di Torino ( ) F.6

7 CSS: font properties (III) font-family: font_name_list ordered list (Courier, Courier New, ) UA chooses the first matching the local fonts useful to specify a generic font in the last position beware of compatibility issues among the listed fonts generic fonts (and compatibility): serif (times, times new roman, palatino,...) sans-serif (arial, helvetica, verdana,...) monospace (courier, courier new, fixed, ) cursive ( comic sans MS, florence,...) fantasy (impact, oldtown,...) CSS: formatting model every block is seen as a container (box) margin (trasparent) border padding content element width container width CSS: container size width: length percentage auto inherit min-width: length percentage inherit max-width: length percentage none inherit content width (fixed, minimum, maximum) height: length percentage auto inherit min-height: length percentage inherit max-height: length percentage none inherit content height (fixed, minimum, maximum) various browsers have different defaults for margin, border and padding set them explicitly CSS: margin and padding size margin-left, margin-right, margin-top, marginbottom: auto length percentage percentage refers to the parent s length margin: m_top_bottom_left_right margin: m_top_bottom m_left_right margin: m_top m_right_left m_bottom margin: m_top m_right m_bottom m_left shorthand notation (in 4 versions) for margin length same parameter number correspondence used also for borders padding-left, padding-right, padding-top, paddingbottom, padding: auto length percentage CSS: containers borders border-top-style, border-right-style, border-bottom-style, border-left-style, border-style: none hidden dotted dashed solid double groove ridge inset outset style of a specific border or shorthand notation border-top-width, border-right-width, right border-bottom-width, border-left-width, border-width: thin medium thick width width of a specific border or shorthand notation border-top-color, border-right-color, border-bottom-color, border-left-color, border-color: color transparent inherit color of a specific border or shorthand notation CSS: shorthand notations for borders border-top, border-right, border-bottom, border-left, border: [ width ] [ style ] [ color ] in the shorthand notation "border, you can set a single value for all the borders border: medium ridge red A.Lioy - Politecnico di Torino ( ) F.7

8 CSS: link properties use the following pseudo-classes to define the style for the various states of links: :link (not visited) :visited (visited) :active (clicked) :hover (pointed with the mouse) you can also associate classes/styles with the A tag (independently by the status) a:link { color: blue } a:hover { background: aqua } a.semplice { text-decoration: none } CSS: graphic layout positioning of various containers (boxes) float: left right none mobile container horizontal positioning with respect to the parent clear: left right both none which sides of the container CANNOT be aside of the previous floating containers NOTE: several instructions, quite complex model, refer to the standard A standard template for pages with header, footer, menu and content modern and standard: uses CSS for formatting uses DIV for layout inspired to header menu footer content Template: HTML part (I) <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" " <html lang= en"> <meta http-equiv="content-type" content="text/html; charset=iso "> <meta name="author" content="a A.Lioy Lioy"> <title>page title</title> <meta name="keywords" content="web tutorial"> <link rel="stylesheet" href="polito.css" type="text/css"> <body> <div id="header"> <h1>page title</h1> </div> Template: HTML part (II) <div id="navigation"> <h2>menu</h2> <ul> <li><a href="p1.html">first</a></li> <li><a href="p2.html">second</a></li> </ul> </div> <div id="content"> <h2>content</h2> <p>page content.</p> </div> <div id="footer"> <h2>author</h2> <p>author name and contact info.</p> </div> </body> </html> body {... } Template: CSS div { border: 1px solid Black; padding: 1ex; } h1, h2, h3, h4, h5, h6 { margin: 0; } #navigation { float: left; width: 10ex; } #navigation ul { list-style: none; margin: ; padding: ; } #content { margin-left: 12ex; } #footer { clear: both; } A.Lioy - Politecnico di Torino ( ) F.8

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

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

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

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

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

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

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

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

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

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

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

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

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

- 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

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

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

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

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

- 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

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

<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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 3 Slide 1 of 16 Week 3 Agenda

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

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

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

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

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

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

Make a Website. A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1

Make a Website. A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1 Make a Website A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1 Overview Course outcome: You'll build four simple websites using web

More information

This tutorial will help both students as well as professionals who want to make their websites or personal blogs more attractive.

This tutorial will help both students as well as professionals who want to make their websites or personal blogs more attractive. About the Tutorial CSS is used to control the style of a web document in a simple and easy way. CSS stands for Cascading Style Sheets. This tutorial covers both the versions CSS1 and CSS2 and gives a complete

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

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

ACSC 231 Internet Technologies

ACSC 231 Internet Technologies ACSC 231 Internet Technologies Lecture 7 Web Typography Efthyvoulos Kyriacou - Assoc. Prof. Frederick University Resources: C. Markides (Frederick University) Slide 1 ACSC 231: Internet Technologies 23/12/2008

More information

Media-Specific Styles

Media-Specific Styles Media-Specific Styles Same HTML, Different CSS R. Scott Granneman r Jans Carton 1.5 2008 R. Scott Granneman Last updated 2017-06-13 You are free to use this work, with certain restrictions. For full licensing

More information

Comp-206 : Introduction to Software Systems Lecture 23. Alexandre Denault Computer Science McGill University Fall 2006

Comp-206 : Introduction to Software Systems Lecture 23. Alexandre Denault Computer Science McGill University Fall 2006 HTML, CSS Comp-206 : Introduction to Software Systems Lecture 23 Alexandre Denault Computer Science McGill University Fall 2006 Course Evaluation - Mercury 22 / 53 41.5% Assignment 3 Artistic Bonus There

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

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

Media Types & Media Features

Media Types & Media Features Media Types & Media Features Same HTML, Different CSS R. Scott Granneman r Jans Carton 1.6 2008 R. Scott Granneman Last updated 2018-08-21 You are free to use this work, with certain restrictions. For

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

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

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

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

<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

Chapter 12: FORMATTING TEXT

Chapter 12: FORMATTING TEXT Disclaimer: All words, pictures are adopted from Learning Web Design (3 rd eds.) by Jennifer Niederst Robbins, published by O Reilly 2007. PART III: CSS FOR PRESENTATION Chapter 12: FORMATTING TEXT CSc2320

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

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

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

ICT IGCSE Practical Revision Presentation Web Authoring

ICT IGCSE Practical Revision Presentation Web Authoring 21.1 Web Development Layers 21.2 Create a Web Page Chapter 21: 21.3 Use Stylesheets 21.4 Test and Publish a Website Web Development Layers Presentation Layer Content layer: Behaviour layer Chapter 21:

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

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

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

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

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

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

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development Objectives INFS 2150 Introduction to Web Development 3. Page Layout Design Create a reset style sheet Explore page layout designs Center a block element Create a floating element Clear a floating layout

More information

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development INFS 2150 Introduction to Web Development 3. Page Layout Design Objectives Create a reset style sheet Explore page layout designs Center a block element Create a floating element Clear a floating layout

More information