CSS. Selectors & Measurments. Copyright DevelopIntelligence LLC

Similar documents
CSS Styles Quick Reference Guide

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

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

8a. Cascading Style Sheet

CSS.

BIM222 Internet Programming

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

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

CSS: Cascading Style Sheets

Tutorial 4: Creating Special Effects with CSS

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

Client-Side Web Technologies. CSS Part I

GIMP WEB 2.0 MENUS WEB 2.0 MENUS: HORIZONTAL NAVIGATION BAR CREATING AN HTML LIST

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

CSS. Shan-Hung Wu CS, NTHU

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

Cascading Style Sheets (CSS)

CSS Cascading Style Sheets

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

Cascading Style Sheets CSCI 311

CSS3 Basics. From & CSS Visual Dictionary Learning Curve Books, LLC

Chapter 3 Style Sheets: CSS

Parashar Technologies HTML Lecture Notes-4

Creating and Building Websites

CSS: The Basics CISC 282 September 20, 2014

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

3. Each of these mark examples contains an error. a. <input name= country value= Your country here. /> b. <checkbox name= color value= teal />

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

Class 3 Page 1. Using DW tools to learn CSS. Intro to Web Design using Dreamweaver (VBUS 010) Instructor: Robert Lee

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

Cascading Style Sheets

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

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar with Dynamic Background Image

ITNP43: HTML Lecture 5

Web Engineering CSS. By Assistant Prof Malik M Ali

Cascade Stylesheets (CSS)

CMPT 165 Advanced XHTML & CSS Part 3

PUBLISHER SPECIFIC CSS RULES

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

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

CSS means Cascading Style Sheets. It is used to style HTML documents.

CSS Cascading Style Sheets

1. The SIZE attribute can be used in which of the following elements? a. FONT b. IFRAME c. SPAN d. STYLE Answer: a Page 86

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar

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

HTML and CSS COURSE SYLLABUS

Web Site Design and Development Lecture 5

Web Design and Development Tutorial 03

CSS exercise - Part 1

CSS THE M\SS1NG MANUAL. David Sawyer McFarland. POGUE PRESS" O'REILLr Beijing Cambridge Farnham Köln Paris Sebastopol Taipei Tokyo

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

Setting a Background Image

CSC309 Programming on the Web week 3: css, rwd

Appendix D CSS Properties and Values

Cascading Style Sheets Level 2

Introduction to Web Tech and Programming

DAY 4. Coding External Style Sheets

Using Advanced Cascading Style Sheets

Zen Garden. CSS Zen Garden

AGENDA :: MULTIMEDIA TOOLS :: (1382) :: CLASS NOTES

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

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

Tutorial 3: Working with Cascading Style Sheets

Styles, Style Sheets, the Box Model and Liquid Layout

First Name Last Name CS-081 March 23, 2010 Midterm Exam

Deccansoft Software Services

KillTest *KIJGT 3WCNKV[ $GVVGT 5GTXKEG Q&A NZZV ]]] QORRZKYZ IUS =K ULLKX LXKK [VJGZK YKX\OIK LUX UTK _KGX

The Importance of the CSS Box Model

ID1354 Internet Applications

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

CSS MOCK TEST CSS MOCK TEST III

Using Dreamweaver CC. 6 Styles in Websites. Exercise 1 Linked Styles vs Embedded Styles

Teach Yourself HTML5 & CSS 3: Week 5 Task 13 - Anchors Part 3

Cascading Style Sheets. Overview and Basic use of CSS

Wanted! Introduction. Step 1: Styling your poster. Activity Checklist. In this project, you ll learn how to make your own poster.

The default style for an unordered (bulleted) list is the bullet, or dot. You can change the style to either a square or a circle as follows:

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

Website Development with HTML5, CSS and Bootstrap

Fundamentals of Web Technologies. Agenda: HTML Links 5/22/2017. HTML Links - Hyperlinks HTML Lists

Using Dreamweaver to Create Page Layouts

Chapter 4 CSS basics

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

WEBSITE PROJECT 2 PURPOSE: INSTRUCTIONS: REQUIREMENTS:

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

Interview Question & Answers

Guidelines for doing the short exercises

CSS: Cascading Style Sheets

Using Dreamweaver CS6

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

IDM 221. Web Design I. IDM 221: Web Authoring I 1

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

READSPEAKER ENTERPRISE HIGHLIGHTING 2.5

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

Assignments (4) Assessment as per Schedule (2)

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

Adding CSS to your HTML

Cascading Style Sheets (CSS)

CMPT 165 Advanced XHTML & CSS Part 4. Oct 20 th, 2015

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

Transcription:

CSS Selectors & Measurments 1

Back to descendants remember walking down the document tree structure and see how parents and children interact not only is it important to know about inheritance walking along the document tree helps us access certain elements we want to pretty-fy in our CSS file 2 2

Back to descendants example: demos/selectors/descendants.html ul li {font-weight:bold; } this says: <li> children of the parent <ul> will be in bold font what would this affect in descendants.html <ul> <li>x</li> <li>y</li> <li>z</li> </ul> 3 3

Back to descendants example: demos/selectors/descendants.html ul li {font-weight:bold; } this says: <li> children of the parent <ul> will be in bold font what would this affect in descendants.html <ul> <li>x</li> <li>y</li> <li>z</li> </ul> x, y and z will be bolded only unordered list items will be affected 3 3

Back to descendants example: demos/selectors/descendants-deep.html walk through descendant crawl can get confusing don t use too much of it in code but it can be quite useful! 4 4

Back to descendants 2 other contextual selectors are available not completely supported (thanks IE... IE6 no, IE7 yes) child selectors #navigation > li {...} select any li element that is a child of an element with id= navigation descendant selector applies to all element descendants child selector applies to immediate descendants (i.e. children) allows outer items to be affected while inner items remain unstyled (i.e. nested items aren t changed) similar to descendent target only the direct children of an element www.w3.org/tr/css21/selector.html 5 5

Back to descendants 2 other contextual selectors are available not completely supported (thanks IE... IE6 no, IE7 yes) adjacent sibling selectors h1 + p {...} first paragraph after <h1> will be styled other paragraphs will be left unchanged target an element that comes directly after another element with the same parent www.w3.org/tr/css21/selector.html 6 6

Pseudo-Element Selectors pseudo-selectors are indicated by the colon (:) 4 main anchor pseudo-classes a:link - style to unclicked (unvisited) links a:visited - style to links that have already been clicked a:hover - style when the mouse pointer is over the link a:active - style when the mouse button is pressed replace legacy code attributes of link, vlink, alink look at demos/selectors/pseudo-links.html look at demos/selectors/pseudo-links2.html they do the same thing / different code text-decoration property - controls underline talk more about this later... 7 7

Pseudo-Element Selectors pseudo-selectors are indicated by the colon (:) main anchor element pseudo-class ordering link visited hover focus active (PayPal) :hover and :active don t work in IE6 unless applied to an anchor <a> :focus is completely ignored by IE6 8 8

Pseudo-Element Selectors other selectors :first-line - styling for the first line of an element properties - color, font, background, word-spacing, letter-spacing, text-decoration, vertical-align, text-transform, line-height p:first-line {font:arial;} :first-letter - styling for the first letter of an element properties - color, font, text-decoration, text-transform, vertical-align, text-transform, background, margin padding, border, float, letter-spacing (CSS2.1), word-spacing (CSS2.1) p:first-letter {font-size:1.5em;} don t worry if you don t know these properties... 9 9

Pseudo-Element Selectors other selectors :before - styling for the first line of an element insert content before an element :after - styling for the first letter of an element insert content after an element not supported by IE 6 or IE 7 CSS p:before {content: First... ;} p:after {content:... Last ;} HTML <p>stuff 2 say</p> Browser First... stuff 2 say... Last 10 10

Pseudo-Element Selectors other selectors CSS2.1 not supported IE6 / they are supported IE7 :focus acts same as :hover for links can be used on other things like forms to highlight where user input is being entered :first-child styling the first child of an element i.e. first <li> in <ul> or first <p> in <div> 11 11

Attribute Selectors target element based on the existence of an attribute IE6 no, IE7 yes img[alt] {...} any img element that has an alt attribute a[href= www.developintelligence.com ] {...} finds link with a www.developintelligence.com as the value 12 12

CSS: Measurments How about units for font size use em measurements, or percentage values allow users to resize text using text-zoom on browsers text can grow or shrink based on their preferences Don t use absolute measurements inches - in, centimeters - cm, millimeters - mm, points - pt or picas - pc 13 13

CSS: Measurments How about units Relative units em measurements unit equal to current font size h1 {font-size:3em;} 3x the current font size based on the width of M percentages h1 {font-size:300%;} 3x the current font size basically the same as em measurements for font size ex measurements height of lowercase x in the font 14 14

CSS: Measurments How about units Relative units px pixel varies with display resolution Font Sizing Techniques How to Size Text Using Ems www.clagnut.com/blog/348 Text Sizing www.thenoodleincident.com/tutorials/box_lesson/font/index.html 15 15

CSS: Measurments How about keywords font-size can take not only units, but also keywords xx-small, x-small, small, medium, large, x-large, xx-large don t connect to particular measurements scaled in relation to one another default is medium text rendered in browsers will never drop below 9 pixels should always be able to read text imprecise and unpredictable some browsers scale @ 120% others use 150% IE 5.5 uses small as default IE 7 better at this :) 16 16

CSS: Measurments How about keywords font-size can take not only units, but also keywords larger & smaller used to shift text size relative to parent element s size amount of change based on browser not in our control easy way to nudge text a little smaller or larger <p> <span style= font-size:larger >larger</span> and <span style= font-size:smaller >smaller</span> </p> Keyword problems? workarounds for keywords CSS Design: Size Matters on A List Apart www.alistapart.com/articles/sizematters/ 17 17