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

Similar documents
CSS: The Basics CISC 282 September 20, 2014

Cascading Style Sheets (CSS)

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

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

Deccansoft Software Services

CSS. Lecture 16 COMPSCI 111/111G SS 2018

Introduction to Web Tech and Programming

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

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

CSS Lecture 16 COMPSCI 111/111G SS 2018

COSC 2206 Internet Tools. CSS Cascading Style Sheets

Assignments (4) Assessment as per Schedule (2)

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

CSS Cascading Style Sheets

Creating and Building Websites

Appendix D CSS Properties and Values

Chapter 3 Style Sheets: CSS

Lab Introduction to Cascading Style Sheets

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

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

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

CSS Styles Quick Reference Guide

CSE 154 LECTURE 3: MORE CSS

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference

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

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

CSS.

CSc 337 LECTURE 3: CSS

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

Cascading Style Sheets Level 2

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

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

CASCADING STYLESHEETS

CSS: formatting webpages

CSS: Cascading Style Sheets

Lab 4 CSS CISC1600, Spring 2012

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

HTML/XML. HTML Continued Introduction to CSS

HTML and CSS COURSE SYLLABUS

Cascading Style Sheets. Overview and Basic use of CSS

Introduction to WEB PROGRAMMING

ITNP43: HTML Lecture 4

CSS for Styling CS380

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

Reading 2.2 Cascading Style Sheets

Using Dreamweaver CS6

8a. Cascading Style Sheet

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

WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5

Web Development & Design Foundations with HTML5

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

Cascade Stylesheets (CSS)

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

ID1354 Internet Applications

BIM222 Internet Programming

Web Development & Design Foundations with HTML5

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

Chapter 4 CSS basics

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

In the early days of the Web, designers just had the original 91 HTML tags to work with.

Adding CSS to your HTML

DAY 4. Coding External Style Sheets

INFORMATICA GENERALE 2014/2015 LINGUAGGI DI MARKUP CSS

APPLIED COMPUTING 1P01 Fluency with Technology

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

Web Design and Development Tutorial 03

CSS. Selectors & Measurments. Copyright DevelopIntelligence LLC

Basic CSS Lecture 17

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

Styles, Style Sheets, the Box Model and Liquid Layout

ICT IGCSE Practical Revision Presentation Web Authoring

ACSC 231 Internet Technologies

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

Controlling Appearance the Old Way

CSS: Cascading Style Sheets

CSC 443: Web Programming

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

CS 350 Internet Applications I Name: Exam II (CSS) October 29, 2013

Fundamentals of Web Programming a

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

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

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

Using Dreamweaver. 6 Styles in Websites. 1. Linked or Imported Stylesheets. 2. Embedded Styles. 3. Inline Styles

Faculty of Engineering Department of Computer Engineering. CSS Tutorial. Eng. Ahmed J. Alajrami

Web Development & Design Foundations with HTML5, 8 th Edition Instructor Materials Chapter 3 Test Bank

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

CSS Cascading Style Sheets

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

CS193X: Web Programming Fundamentals

Chapter 9 Table Basics Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

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

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

> > > > Cascading Style Sheets basics

INTRODUCTION TO CSS. Topics MODULE 5

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

Zen Garden. CSS Zen Garden

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

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

Web Design and Development ACS Chapter 12. Using Tables 11/23/2017 1

Transcription:

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

Learning Objectives Understand the advantages of CSS style sheets in HTML documents Become familiar with the syntax of CSS 3 Limitations of HTML Maintenance Site compatibility Quick change to a site look and feel User overrides Handling by differing User Agents 4 2

Styling in HTML In pure HTML, viewing information is included in the HTML tag <td width= 20 bgcolor= #333399 > head html body Styling is usually contained within the tag and applies to that element table tr td table tr td 5 Styling in HTML/CSS With style sheets (CSS), styling information is contained within a style sheet html td {color:#333399;} head body Styling is usually contained within a style sheet and applies to any matching element table tr td table tr td 6 3

What are Style Sheets? A way to separate the appearance of Web pages from the content of Web pages HTML should not contain information about how data is displayed A recommendation of the W3C A way to standardize appearance for many pages in a Web site Contained within A text file (with a css suffix) written according to a grammar (CSS 1, CSS 2, CSS 2.1, CSS 3, or CSS 4) An HTML style tag Your browser 7 Do Many Web Sites Use Style Sheets? In wide use today, most of it is auto generated by an html generation tool Browser support Vastly improved for current browsers Variations in display are possible 8 4

Style Sheet Example Selector Each of these CSS statements contains directives, referred to as a rule set body {font-family: verdana, "minion web", helvetica, sans-serif; font-size: 1em; text-align: justify;} Property code {font-family: courier, sans-serif; font-size: 1em;} Property value Final ; in a list is not required, but it is good style to use it 9 Selectors Selectors specify how to apply a given style to the html document. Possibilities include: All of the elements td {color:#333399;} Some of the elements td.some {color:#333399;} One of the elements The token (in this case some ) can be any string td#one {color:#333399;} To apply to elements, the affected elements are coded as <td class= some > <td id= one > 10 5

Selectors A selector token can match to multiple elements (class attribute) A single token (id attribute) You can also use a psuedoclass (represents a special characteristic of an element) Examples:.danger { color: red; } a:link { color: green; } a:visited { color: red; } Also visited and hover The components of the anchor element where the link has been visited 11 Some Selector Types HTML element or list of elements (e.g., body, table, h1) Class, as in: and.instruction {css statements} <p class="instruction"> Pseudo-selectors (e.g., mouseover changes, first line & first letter) a:anchor { background-color: yellow } Contextual (e.g., paragraphs inside lists) 12 6

CSS Syntax Every css file contains a series of statements A statement: Identifies the elements it affects (selector) Suggests how the element will be presented to the user (directive properties) A rule-set statement contains a selector and any number of directives enclosed in {} body {font-family: verdana, "minion web", helvetica, sans-serif; font-size: 1em; text-align: justify;} 13 How to Refer to the Style Sheet As an attribute in a tag Syntactically correct, but not a good abstraction <body style="background-color:#fc6"> Embedded (in the head element of the HTML): <style type="text/css">... </style> Linked (to an external.css file): Good for debugging <link rel="stylesheet" type="text/css" href="http://www.westciv.com.au/style/style.css"> Good for production 14 7

Properties Categories Text style Text layout Background Border Margin Padding Page layout (absolute, fixed, relative, static) Element type User interface (cursor, focus-outline) Values Length Percentage URL Color Keyword Others 18 Typical Values Units Absolute values (in, cm, mm, pt, em, px) Relative values (large, percentage) Colors RGB Shorthand notation Percentage primary color contribution Font Family (serif, sans serif, monospace) Weight Size 19 8

div and span Elements In pure HTML, you can apply styling to a collection of elements by enclosing them in a styling element (e.g., font, center, b) <font face=arial,helvetica size=-2>forgot Password?</font> These styling elements are not allowed in newer html versions, so you enclose elements in a container and then apply styling to the container In HTML, the containers are div for block elements span for in-line elements 20 How Do You Convert Spacing CSS assumes that the page is presented by displaying a collection of blocks Each block is displayed using the CSS box model Sides can be set individually or for the entire box Values of the padding, border, and margin can be set to 0 21 9

HTML Style Attribute It is syntactically correct to apply a CSS style to an individual element Example <table width="715"> Can be replaced with But of limited usefulness <table style="width:715"> 22 Multiple Style Sheets Cascading implies a priority list of styling operations (usually the order they are encountered in the rendering process) Style tag Additional style tags Style attribute within the html Style within the browser Cascading allows individual tailoring without eliminating global styles 23 10

Example H1, H2, H3, H4, H5, H6, DT, TH, THEAD, TFOOT { color: rgb(245,245,245); background: #212121; } A:link { text-decoration: none; font-weight: bold; color: #F60; background: #212121; } Look at CSE336 Web site A:visited { text-decoration: none; font-weight: bold; color: #C96; background: #212121; }... 26 Applying a style sheet CSS Concept Summary Selector tells you where a style is applied Property tells you what style is being applied Apply a style to a container (e.g., div block) Use class attributes to apply a style to a semantic block not recognized component not known to html (e.g., error message) 27 11

Have You Satisfied the Lecture Objectives Understand the advantages of CSS style sheets in HTML documents Become familiar with the syntax of CSS 28 12