CMPT 165 Unit 3 CSS Part 1. Sept. 24 th, 2015

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

CMPT 470: Web-based Information Systems

CMPT 165 Unit 2 Markup Part 2

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

Chapter 3 Style Sheets: CSS

Admin & Today s Agenda

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

CMPT 165 Advanced XHTML & CSS Part 3

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

Reading 2.2 Cascading Style Sheets

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

Fundamentals: Client/Server

CS134 Web Site Design & Development. Quiz1

HTML and CSS COURSE SYLLABUS

Web Publishing Basics I

CSS: The Basics CISC 282 September 20, 2014

Appendix D CSS Properties and Values

Shane Gellerman 10/17/11 LIS488 Assignment 3

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

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

Assignments (4) Assessment as per Schedule (2)

Index. alt, 38, 57 class, 86, 88, 101, 107 href, 24, 51, 57 id, 86 88, 98 overview, 37. src, 37, 57. backend, WordPress, 146, 148

Overview. Part I: Portraying the Internet as a collection of online information systems HTML/XHTML & CSS

What is CSS? NAME: INSERT OPENING GRAPHIC HERE:

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

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

XHTML & CSS CASCADING STYLE SHEETS

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

Downloads: Google Chrome Browser (Free) - Adobe Brackets (Free) -

CSS. Lecture 16 COMPSCI 111/111G SS 2018

Web Engineering CSS. By Assistant Prof Malik M Ali

Introduction to Web Design CSS Reference

Programmazione Web a.a. 2017/2018 HTML5

Introduction to Web Design CSS Reference

The internet is a worldwide collection of networks that link millions of computers. These links allow the computers to share and send data.

introduction to XHTML

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

CSS Lecture 16 COMPSCI 111/111G SS 2018

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

Web Site Design and Development Lecture 5

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

Skill Area 323: Design and Develop Website. Multimedia and Web Design (MWD)

ATSC Week 2 Web Authoring

Controlling Appearance the Old Way

ID1354 Internet Applications

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

CSS Cascading Style Sheets

Admin. (Reminder) coursework submission procedure: 2.??? Submit URL to CourseSys (URL as instructed) 1. Upload

INFORMATICA GENERALE 2014/2015 LINGUAGGI DI MARKUP CSS

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

What is XHTML? XHTML is the language used to create and organize a web page:

Cascading style sheets

HTML Overview. With an emphasis on XHTML

ICT IGCSE Practical Revision Presentation Web Authoring

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

Lab 4 CSS CISC1600, Spring 2012

Final Exam Study Guide

How the Internet Works

7300 Warden Avenue, Suite 503 Markham, Ontario Canada L3R 9Z6. Phone: Toll Free: Fax:

LA TROBE UNIVERSITY SEMESTER ONE EXAMINATION PERIOD CAMPUS AW BE BU MI SH ALLOWABLE MATERIALS

Hyper Text Markup Language HTML: A Tutorial

Web Development & Design Foundations with XHTML. Chapter 2 Key Concepts

Markup Language SGML: Standard Generalized Markup Language. HyperText Markup Language (HTML) extensible Markup Language (XML) TeX LaTeX

Announcements. Paper due this Wednesday

Chapter 1 Getting Started with HTML 5 1. Chapter 2 Introduction to New Elements in HTML 5 21

Ministry of Higher Education and Scientific Research

GIMP WEB 2.0 MENUS. Before we begin this tutorial let s visually compare a standard navigation bar and a web 2.0 navigation bar.

As we design and build out our HTML pages, there are some basics that we may follow for each page, site, and application.

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

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

Chapter 4. Introduction to XHTML: Part 1

Lab Introduction to Cascading Style Sheets

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

Making Backgrounds With Paint Shop Pro

CHAPTER 2 MARKUP LANGUAGES: XHTML 1.0

ITNP43: HTML Lecture 4

CSS for Styling CS380

Introduction to WEB PROGRAMMING

2005 WebGUI Users Conference

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

Designing the Home Page and Creating Additional Pages

CREATING A WEBSITE USING CSS. Mrs. Procopio CTEC6 MYP1

COMS 359: Interactive Media

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

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

Web Programming and Design. MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh

The Internet & The World Wide Web

Introduction to HTML & CSS. Instructor: Beck Johnson Week 2

HTML & CSS. Rupayan Neogy

Dreamweaver CS3 Lab 2

Using Dreamweaver 2 HTML

CSS Cascading Style Sheets

CSC309 Tutorial CSS & XHTML

CMPT 165 Unit 7 Intro to Programming - Part 5. Nov 20 th, 2015

COMP519 Web Programming Lecture 3: HTML (HTLM5 Elements: Part 1) Handouts

Creating A Web Page. Computer Concepts I and II. Sue Norris

HTML TUTORIAL ONE. Understanding What XHTML is Not

HTML/XML. HTML Continued Introduction to CSS

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

Navigation. Websites need a formalized system of links to allow users to navigate the site

Transcription:

CMPT 165 Unit 3 CSS Part 1 Sept. 24 th, 2015

Summary of key concepts/terms Components of good website designs and why? Structure of a markup file: DTD vs. head vs. body Elements vs. tags vs. content: know the difference Tags examined so far: List <ol><ul><li><dl><dt><dd> Image <img> Anchor <a> Usage info: http://www.w3schools.com/tags/ Other important concepts: Tags vs. attributes Relative vs. absolute URL (from last Thurs.) Terms to keep in mind (more late) Style vs. semantic meaning of an element Usability + accessibility issues 2

(Templates for) defining lists <h1>unordered list</h1> <ul> <li></li> </ul> <h1>ordered list</h1> <ol> <li></li> </ol> <h1>definition list</h1> <dl> <dt>term</dt><dd>description</dd> </dl> <dt>: definition term <dd>: definition description 3

What s wrong? <img href="http://troy.lib.sfau.ca/screens/banner_left.jpg" alt="the library logo"> <img src="http://troy.lib.sfau.ca/screens/banner_left.jpg" alt="the library logo"/> <img src="http://www.w3.org/2015/05/logowww2015.png" alt="another logo" width=50%" height="25%" /> <img src="http://www.w3.org/2015/05/logowww2015.png" alt="another logo" width="50% height="25%" /> 4

And how about this? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" <html> <h1>exercise 1 "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <title>exercise1</title> </h1> <body> <head>cmpt165 Lab 01</head> <p>lorem ipsum dolor sit amet, eum ad insolens sadipscing philosophia, nostro recusabo posidonium ne mea. Cu clita aperiri cum, eam ad labore philosophia. Ius cotidieque efficiantur ad. Noster integre intellegat has ex. Eu pro volutpat tractatos. Salutatus forensibus no quo. </p> <p1>eum ad insolens sadipscing philosophia, nostro recusabo posidonium ne mea. Cu clita aperiri cum, eam ad labore philosophia. Ius cotidieque efficiantur ad. Noster integre intellegat has ex. Eu pro volutpat tractatos. Salutatus forensibus no quo.</p1> </body> </html> 5

And how about this? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" <html> <h1>exercise 1 "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <title>exercise1</title> </h1> <body> <head>cmpt165 Lab 01</head> <p>lorem ipsum dolor sit amet, eum ad insolens sadipscing philosophia, nostro recusabo posidonium ne mea. Cu clita aperiri cum, eam ad labore philosophia. Ius cotidieque efficiantur ad. Noster integre intellegat has ex. Eu pro volutpat tractatos. Salutatus forensibus no quo. </p> <p1>eum ad insolens sadipscing philosophia, nostro recusabo posidonium ne mea. Cu clita aperiri cum, eam ad labore philosophia. Ius cotidieque efficiantur ad. Noster integre intellegat has ex. Eu pro volutpat tractatos. Salutatus forensibus no quo.</p1> </body> </html> Q: Was it easy to read this code? Q: How would you improve its readability? 6

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" <html> <head> </head> <body> "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <title>exercise1</title> <h1>cmpt165 Lab 99</h1> <! - Intro about myself --> How about this? Indentation Indentation Use spaces generously It s free! Add comments to remind yourself of things <p>lorem ipsum dolor sit amet, eum ad insolens sadipscing philosophia, nostro recusabo posidonium ne mea. Cu clita aperiri cum, eam ad.</p> <! - Code below was as extension from lab 2 --> <p>eum ad insolens sadipscing philosophia, nostro recusabo posidonium ne mea. Cu clita aperiri cum, eam ad labore philosophia.</p> </body> </html> 7

Ways to improve code readability 1. Spacing 2. Indentation <h1>common fruits in BC</h1> <ul> <li>apples <ul><li>granny smith</li> <li>golden delicious</li> </ul> </li> <li>oranges <ul><li>naval oranges</li><li>mandarin oranges </li></ul></li> <li>bananas</li> </ul> <h1>common fruits in BC</h1> <ul> <li>apples <ul> <li>granny smith</li> <li>golden delicious</li> </ul> </li> <li>oranges <ul> <li>naval oranges</li> <li>mandarin oranges </li> </ul> </li> <li>bananas</li> </ul> 3. Add comments: <!-- text in here is ignored by browser --> 4. Other ideas? 8 vs.

Questions?

Elements to good webpage designs CONTENT Messages to your audience You provide in this course reminder: typos/grammar? (professionalism/ impression) INTERACTION Give feedback/responses to your audience Web-programming (Python, Javascript, PHP, etc.) STRUCTURE Give semantic meaning to each element Meta data (meta=about) Done via a markup language STYLE Describe visual properties of each element Cascading Style Sheets (CSS) 10

Effect of styling What do sites look like without style? To turn on/off: 11

Cascading Style Sheets (CSS) A sheet defining styles Why cascading? Answered later Why CSS? By now, you should know what it serves E.g. you want center-align all your paragraphs To center-align, one way is to add attributes in your markup: <p align="center"> 12

Structure of an essay <h1> The coolest dissertation </h1> <p align="center"> By ABC </p> <h2> I. Introduction </h2> <h2> II. Body </h2> <h3> II.A - Topic 1 </h3> <h4> II.A.i - Subtopic A </h4> <h4> II.A.ii - Subtopic B </h4> <h3> II.B - Topic 2 </h3> <h4> II.B.i - Subtopic A </h4> <h4> II.B.ii - Subtopic B </h4> <h2> III. Conclusion </h2> 13

A complete example <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html> <head> <title>title</title> </head> <body> <h1>heading</h1> </body> </html> Q: What happens when you have an essay of 8 paragraphs? A: Specify align attribute for each paragraph??? <p align="center">this is Paragraph1.</p> <p align="center">this is Paragraph2.</p> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html> <head> <title>title</title> </head> <body> But what if you have 100 paragraphs??? <h1>heading</h1> <p align="center">this is Paragraph1.</p> <p align="center">this is Paragraph2.</p> <p align="center">this is Paragraph3.</p> <p align="center">this is Paragraph4.</p> <p align="center">this is Paragraph5.</p> <p align="center">this is Paragraph6.</p> <p align="center">this is Paragraph7.</p> <p align="center">this is Paragraph8.</p> </body> </html> CMPT 165 D1 (Summer 2005) 14

<style> tag <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html> <head> <title>title</title> </head> <body> <h1>heading</h1> <p align="center">this is Paragraph1.</p> <p align="center">this is Paragraph2.</p> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>title</title> <style type="text/css"> p { text-align: center; Demo } </style> </head> <body> <h1>heading</h1> <p>this is a paragraph.</p> <p>this is another paragraph.</p> </body> </html> 15

<style> tag <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/tr/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>title</title> <style type="text/css" media="all" > p { Required attribute Optional attribute text-align: center; } h1 { text-align: center; color: red; } </style> </head> <body> <h1>heading</h1> <p>this is a paragraph.</p> <p>this is another paragraph.</p> </body> </html> 16

CSS syntax Selector: an HTML element that you want to style selector1 { property_1: value_1; property_2: value_2; property_n: value_n; } selector2 { property_1: value_1; property_2: value_2; property_m: value_m; } Note: declarations are separated by semicolons! Curly brace Declaration ol { list-style-type: circle; start: a; } p { text-align: center; } vs. Attribute specification in older versions of HTML name_of_attribute="value" <p align=" center"> 17

3 ways to define visual styles 1. In the header 2. Inline <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <title>title</title> <style type="text/css > p{ text-align: center; color: blue; } </style> </head> <body> <h1>heading</h1> <p>this is a paragraph.</p> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <title>title</title> </head> <body> <h1>heading</h1> <p style= text-align: center; color: blue; >This is a paragraph.</p> </body> </html> </body> </html> CMPT 165 D1 (Summer 2005) 18

3 ways to define visual styles 1. In the header 2. Inline 3. In a separate CSS file: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <title>title</title> <style type="text/css"> p { text-align: center; remove } </style> </head> <body> <h1>heading</h1> <p>this is a paragraph.</p> <p>this is another paragraph.</p> </body> </html> 19

Linking to an external stylesheet second_page.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> index.html <html> <head> <html> <title>page 2</title> <head> <link href= my_style.css" type="text/css" /> </head> <title>title</title> <body> <link href= my_style.css" type="text/css" /> </head> <h1>heading</h1> <body> <p>this is yet another page.</p> </body> <h1>heading</h1> </html> <p>this is a paragraph.</p> <p>this is another paragraph.</p> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> my_style.css p { text-align: center; } 20

3 ways to styling markup 1. Inline 2. In the header 3. In a separate CSS file Amount of work? Most Least 21

CSS: Summary What? Cascading stylesheet? Cascading : answered later Why CSS? You should know How? <style> <link> 22

Tags: List Image Anchor Key items learned so far Linking to external data Styling <ol><ul><li><dl><dt><dd> <img> <a> <link> <style> http://www.w3schools.com/tags/ Key concepts: Relative vs. Absolute URL Attribute specification vs. stylesheet attribute= value vs. CSS (selector, property, value) 23

Q/A

http://cmpt165.cs.sfu.ca/ ~ lisat /demos/sfu_logo.png Local Remote 25

Absolute vs. Relative URL SFU_logo.png + index.html in same folder (demos) index.html: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html> <head><title>title</title></head> <body> <h1>heading</h1> <p> <img src="http://fraser.sfu.ca/ ~lisat/demos/sfu_logo.png" /> </p> <p><img src="sfu_logo.png" /></p> </body> </html> 26

index.html: Absolute vs. Relative URL SFU_logo.png + index.html not in same folder Q: what is the relative URL for the SFU_logo.png file? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html> <head><title>title</title></head> <body> /home/lisat/public_html/sfu_logo.png <h1>heading</h1> /home/lisat/public_html/demos/index.html <p> <img src="http://cmpt165.csil.sfu.ca/ ~lisat/sfu_logo.png" /> </p> <p><img src="../sfu_logo.png" /></p> </body> </html> Answer: use.. ( parent directory) parent directory 27

index.html: Absolute vs. Relative URL SFU_logo.png + index.html not in same folder Q: what is the relative URL for the SFU_logo.png file? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html> <head><title>title</title></head> <body> /home/lisat/public_html/sfu_logo.png <h1>heading</h1> /home/lisat/public_html/d1/d2/index.html <p> <img src="http://cmpt165.csil.sfu.ca/ ~lisat/sfu_logo.png" /> </p> <p><img src="../../sfu_logo.png" /></p> </body> </html> grandparent directory? 28

index.html: Absolute vs. Relative URL SFU_logo.png now moved to another subfolder test Q: what is the relative URL for the SFU_logo.png file? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html> <head><title>title</title></head> <body> /home/lisat/public_html/test/sfu_logo.png <h1>heading</h1> /home/lisat/public_html/d1/d2/index.html <p> <img src="http://cmpt165.csil.sfu.ca/ ~lisat/test/sfu_logo.png" /> </p> <p><img src="../../test/sfu_logo.png"/></p> </body> </html> grandparent directory? 29

Questions?

Putting all in context (from last Tues.) Keywords: URL: a resource, e.g. a file: study-guide.pdf, E1.html Upload Local vs. remote Steps: 1. You do coursework on your local computer, e.g. C:\user\165\E1.html 2. When done, you upload files to a remote server that accepts request for resource You store these files in a file location on our cmpt165 (remote) server, e.g. cmpt165.csil.sfu.ca\home\lisat\public_html\e1.html Others on Internet may request to view E1.html using this URL: http:\\cmpt165.csil.sfu.ca\~lisat\e1.html Server cmpt165 is configured to look at the location \home\lisat\public_html 3. Users request the URL of your work from their browser (e.g. Firefox, etc.)

Questions?

CMPT 165 Unit 3 CSS Colour Sept. 24 th, 2015

CSS: background Levels (version number): Level 1: released in Dec 1996 Level 2: released in May 1999 Level 2.1: released in June 2011 Level 3 is being developed Level 4 is planned for the future 34

CSS Level 1 Style support for: Color of element text, backgrounds, etc. Alignment of elements (text, images, etc.) Text formatting: e.g. spacing of words, letters, lines Font properties: typeface and emphasis Boxing: margin, border, padding, and positioning Unique identification: explained later Generic classification: explained later 35

Colors 17 standard color presets in CSS 1 White Silver Gray Black Red Maroon Yellow Olive Orange Lime Green Aqua Teal Blue Navy Fuchsia Purple 36

RGB model primary colors : Red + Green + Blue Additive model: i.e. Red + Green = Yellow Red + Blue = Purple RGB model/coding: A system for specifying colors A numerical value reflecting intensity ( strength ) of a color channel: e.g. 5 is brighter than 0 8 is brighter than 2 http://en.wikipedia.org/ wiki/file:additivecolor.svg 3 channels 3 sets of values, e.g. Bright red given by 900 37

RGB model Red Green Blue Examples: Bright green? Dark green? Bright blue? Dark red? Dark blue? Purple? Black? Gray? Possible RGB encoding: 0 9 0 0 5 0 0 0 9 5 0 0 0 0 5 5 0 5 0 0 0 5 5 5 38

Color specification Decimal system (base=10): 0 1 2 3 4 5 6 7 8 9 Darkest Brightest This is not used in CSS! CSS uses hex system Hexadecimal system (base=16): 0 1 2 3 4 5 6 7 8 9 A B C D E F Darkest Brightest Example: Brightest red? RGB = X X X? = F 0 0 39

RGB model Red Green Blue Examples: Bright green? Dark green? Bright blue? Dark red? Dark blue? Purple? Black? Gray? 0 1 2 3 4 5 6 7 8 9 Decimal 0 9 0 0 5 0 0 0 9 5 0 0 0 0 5 5 0 5 0 0 0 5 5 5 0 1 2 3 4 5 6 7 8 9 A B C D E F Hexadecimal 0 F 0 0 8 0 0 0 F 8 0 0 0 0 8 8 0 8 0 0 0 8 8 8 40

Always start with hash key (#), e.g. Colour specification in CSS p { } background-color: #0F0; color: #AF0; hr { border-color: #0a0; color: black; } 41

We ll look more on colour specification next class

Today s Highlights CSS: motivation and practicalities So far, things we learned related to CSS: RGB color model Hexadecimal color coding 3 ways to colour specification in both CSS+Markup 43

Tips for preparing the exams Exercise on your own: summarize key concepts seen so far in Unit 1 + Unit 2 For all coursework: start by writing the code in paper + pen! 44