CSS Lecture 16 COMPSCI 111/111G SS 2018

Similar documents
CSS. Lecture 16 COMPSCI 111/111G SS 2018

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference

Appendix D CSS Properties and Values

CSS: The Basics CISC 282 September 20, 2014

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

Controlling Appearance the Old Way

Reading 2.2 Cascading Style Sheets

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

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

Adding CSS to your HTML

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

CSS for Styling CS380

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

Cascading Style Sheet Quick Reference

Cascade Stylesheets (CSS)

CSC 443: Web Programming

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

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

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

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

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

Introduction to Web Tech and Programming

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

COSC 2206 Internet Tools. CSS Cascading Style Sheets

Assignments (4) Assessment as per Schedule (2)

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

Fundamentals of Web Programming a

HTML/XML. HTML Continued Introduction to CSS

Lab Introduction to Cascading Style Sheets

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

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

Lecture B3 Style : Algorithmic Thinking. Computing and Art : Nature, Power, and Limits CC 3.12: Fall 2007

ICT IGCSE Practical Revision Presentation Web Authoring

ITNP43: HTML Lecture 4

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

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

ID1354 Internet Applications

CASCADING STYLESHEETS

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

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

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

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

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

Cascading Style Sheets (CSS)

CSC 337. Cascading Style Sheets. Marty Stepp, Rick Mercer

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

CSc 337 LECTURE 3: CSS

CSS Cascading Style Sheets

CSS Styles Quick Reference Guide

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

Chapter 3 Style Sheets: CSS

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

2005 WebGUI Users Conference

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

Web Development & Design Foundations with HTML5

Creating and Building Websites

Web Development & Design Foundations with HTML5

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

CSS.

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

Web Design and Development Tutorial 03

WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5

Cascading Style Sheets

Introduction to Cascading Style Sheets

Chapter 12: FORMATTING TEXT

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

CSS: Cascading Style Sheets

UNIVERSITI TEKNOLOGI MALAYSIA TEST 1 SEMESTER II 2012/2013

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

Salvedicta. - Hans Selye CSC 210

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

Web Site Design and Development Lecture 5

CSS. Text & Font Properties. Copyright DevelopIntelligence LLC

CSE 154 LECTURE 3: MORE CSS

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

Chapter 4 CSS basics

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

CMPT 165: More CSS Basics

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

Methods for configuring Cascading Style Sheets. Applying style to element name selectors. Style Rule Basics. CMPT 165: Cascading Style Sheets

CSS: formatting webpages

Cascading Style Sheets. Overview and Basic use of CSS

Basic CSS Lecture 17

INFORMATICA GENERALE 2014/2015 LINGUAGGI DI MARKUP CSS

B3: A first introduction to CSS 17/02/2006

CSC309 Programming on the Web week 3: css, rwd

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

.hedgehog { background-image: url(backyard.jpg); color: #ffff99; height: 6in; width: 12in; } .tube {

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

Web Programming and Design. MPT Senior Cycle Tutor: Tamara Week 2

Web Engineering CSS. By Assistant Prof Malik M Ali

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

INTRODUCTION TO CSS. Mohammad Jawad Kadhim

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

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

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

Basic Web Pages with XHTML (and a bit of CSS) CSE 190 M (Web Programming), Spring 2008 University of Washington Reading: Chapter 1, sections

Web Site Design and Development Lecture 6

Transcription:

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; h1, h2 text-align: right; background-color: black; color: white;.footer border-top-width: border-top-style: font-size: small; thick; solid; http://csszengarden.com.catname font-weight: bold;

Same page, different style sheet Defining a style body background-color: #eeffee; h1, h2 text-align: center; border-bottom-color: black; border-bottom-style: solid; color: black; text-transform: uppercase; p:first-letter font-size: x-large;.footer text-align: right; font-size: small;.catname visibility: hidden; Styles are defined using rules Selector determines what the rule applies to Property the thing that will be changed Value the value that will be used h1 color: green; Selector Property Value Grouping rules Multiple tags that use the same rule h1 font-weight: bold h2 font-weight: bold Same style defined for multiple selectors h1, h2 font-weight: bold Grouping rules Same tag using multiple rules h1 color: green h1 text-align: center Apply multiple properties to the same selector h1 color: green; text-align: center;

Class selectors Sometimes want to apply a style to specified tags Most paragraphs are normal Some paragraphs are quotes Define astyle that can be applied to a group of tags Class selector Example class selector Style defined as follows:.quote text-align: font-style: center; italic; In HTML5 source code Assign the tag to the class Use an attribute.classname property: value; HTML5 source code uses the style as follows: <p class="quote"> Let's face it, the average computer user has the brain of a Spider Monkey --- Bill Gates </p> <tag class="classname"> </tag> ID selectors Sometimes want to apply a style to a single tag E.g. Defining a special heading Define astyle that can be applied to a single tag Id selector Style defined as follows: Example id selector #footer text-align: font-style: center; italic; In HTML5 source code #idname property: value; Use an attribute to specify the id used for the tag HTML5 source code uses the style as follows: <p id="footer"> Copyright 2015 </p> <tag id="idname"> </tag>

Exercises What is a selector in a CSS style? Three possible locations External style sheet Internal style sheet Inline styles Location of the styles Styles are defined in a file External Style Sheet Used when styles apply to more than one web page Entire site has a consistent visual theme.quote text-align: center; h1 color: green; Web page must be told where to find the style sheet <link> tag has 3 attributes: rel specifies relationship between current document and linked document href specifies location of linked document type specifies media type of linked document Is an empty tag so only an opening <link> tag is required. Saved in a file called theme.css <head> <title> </title> <link rel="stylesheet" href="theme.css" type="text/css"> </head> Internal Style Sheet Styles are defined in the head of the page Used when styles apply to only the one web page Keeps all the visual formatting located in the same place <style type="text/css"> Used in the head of the document to contain styles type attribute specifies media type of the <style> tag <head> <title>example</title> <style type="text/css">.quote text-align: center; h1 color: green; </style> </head>

Inline styles Cascading Style Sheets Styles are defined in the tag Used when style is applied only to that tag Can be required to override styles Rarely used (why would you?) Order to apply styles 1. Browser default 2. External style sheet 3. Internal style sheet 4. Inline styles Increasing priority <p style="text-align: center;"> This paragraph will be centred using an inline style. </p> http://en.wikipedia.org/wiki/cascading_style_sheets http://en.wikipedia.org/wiki/comparison_of_layout_engines_(css) Exercises Write a simple HTML5 page with the title Simple CSS example. The body of the page should contain a single paragraph with the text Hello. The text should have the color property set to green. An internal style sheet should be used to define an appropriate style that can be applied to the paragraph. Exercises Put the following into increasing order of priority. The item at the bottom of the list should have the highest priority. Internal Style, Browser Default, Inline Style, External Style

<div> and <span> Font Two additional tags used with CSS <div> Allow a style to be applied to arbitrary group of elements Block level tag May contain other block level tags Invisible in HTML5, but can have styles applied <span> Inline tag May contain other inline tags Invisible in HTML5, but can have styles applied font-family serif, sans-serif, cursive, fantasy, monospace font-size xx-small, x-small, x-large, xx-large, font-style normal, italic font-variant normal, small-caps font-weight normal, bold small, medium, large, length (e.g. 24pt) http://www.w3.org/style/examples/007/fonts.en.html 22 Use a variety of units cm mm pt px Lengths Font example body font-family: "Comic Sans MS", cursive; font-size: large; font-style: normal; font-variant: normal; font-weight: bold; CSS 23 CSS 24

Exercises Define a style that is applied to all paragraphs and changes the font so that it is 16pt and bold. Background background-color Define a style that is applied to all h2 headings and changes the font to small caps. body background-color: black; Define the styles required to make all the text in the body of a document use italicised sans serif font, preferably Verdana or Helvetica. 26 Text Text example color black (default), red, green, blue, white, yellow, etc. text-align left (default), right, center, justify body color: blue; text-align: justify; text-indent: 1cm; text-transform: lowercase; text-indent length text-transform none (default), capitalize, uppercase, lowercase

Colours Exercises Sixteen colour names black, red, green, blue, white, yellow, aqua, fuchsia, gray, lime, maroon, navy, olive, purple, silver, teal RGB values rgb(xxx, xxx, xxx) xxx = 0 255 Hex values Define the styles required to make the background of the entire page silver, and the text coloured black. The main heading should have a black background and white font. Define a style for an id selector called greentext so that any element that uses it has green font. You must use hex values for the color. Write a fragment of HTML5 code that applies the style you have defined to the word grass in the paragraph The grass is green. #rrggbb rr, gg, and bb = 0 255 values represented in hexadecimal (base 16): 0 - ff Borders Borders border-color color border-style none (default), dotted, " dashed, solid, double, etc. border-width p border-color: border-style: border-width: green; double; medium; thin, medium, thick, length

Borders Can set borders individually for each side of the element: xxx = left, right, top, bottom Property: Border Table Borders border-xxx-color As for border-color border-xxx-style As for border-style border-xxx-width Value: width style colour E.g. 1px solid black Should be specified for all table elements: table, tr, td border: 1px solid black; As for border-width