INTRODUCTION TO CSS. Topics MODULE 5

Similar documents
CSS Cascading Style Sheets

Client-Side Web Technologies. CSS Part I

CSS.

CSS: The Basics CISC 282 September 20, 2014

CSS Cascading Style Sheets

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

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

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

Cascading Style Sheets Level 2

BIM222 Internet Programming

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference

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

Web Site Design and Development Lecture 5

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

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

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

Creating and Building Websites

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

Cascading Style Sheets CSCI 311

CSS: Cascading Style Sheets

Cascading Style Sheets (CSS)

Reading 2.2 Cascading Style Sheets

Zen Garden. CSS Zen Garden

DAY 4. Coding External Style Sheets

Appendix D CSS Properties and Values

Chapter 3 Style Sheets: CSS

CSS

Deccansoft Software Services

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

CSC309 Programming on the Web week 3: css, rwd

HTML/CSS. HTML review and extra CSS review CSS Color

CSS. Lecture 16 COMPSCI 111/111G SS 2018

Scripting for Multimedia LECTURE 5: INTRODUCING CSS3

CE419 Web Programming. Session 3: HTML (contd.), CSS

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

CSS: Cascading Style Sheets

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

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

Assignments (4) Assessment as per Schedule (2)

CSS Lecture 16 COMPSCI 111/111G SS 2018

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

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

Tutorial 02: Getting Started with CSS

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

INTRODUCTION TO CSS. Mohammad Jawad Kadhim

Web Engineering CSS. By Assistant Prof Malik M Ali

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

CSS. Shan-Hung Wu CS, NTHU

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

Cascading Style Sheet Quick Reference

CITS3403 Agile Web Development 2019 Semester 1

Introduction to WEB PROGRAMMING

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

Web Development & Design Foundations with HTML5

CSS 1: Introduction. Chapter 3

Web Design and Development Tutorial 03

Controlling Appearance the Old Way

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

Web Development & Design Foundations with HTML5

Website Development with HTML5, CSS and Bootstrap

Parashar Technologies HTML Lecture Notes-4

CITS3403 Agile Web Development 2018, Semester 1

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

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

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

Styling Web Applications Presented by Roel Fermont

McMaster Brand Standard for Websites

Cascade Stylesheets (CSS)

To Ponder. Which one wins? .draft div.warning li { }.draft div #main li {!important; } div #main ul li { }.draft.warning ul li { }

Data Visualization (CIS/DSC 468)

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

READSPEAKER ENTERPRISE HIGHLIGHTING 2.5

IBM Forms V8.0 Custom Themes IBM Corporation

Anatomy of a Style. Cascaded Style Sheets - CSS. CSS Presentation Description Language. Measurement Specification

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

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

Styles, Style Sheets, the Box Model and Liquid Layout

CS7026 CSS3. CSS3 Graphics Effects

Multimedia Systems and Technologies Lab class 6 HTML 5 + CSS 3

CSS: formatting webpages

WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5

> > > > Cascading Style Sheets basics

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

Introduction to using HTML to design webpages

CPET 499/ITC 250 Web Systems. Topics

CS 350 COMPUTER/HUMAN INTERACTION. Lecture 6

Programmazione Web a.a. 2017/2018 HTML5

Introduction to CSS. Part 1: Simple Text Formatting. Source Files for this Exercise are available on the Course Website DW_CSS intro

Chapter 4 CSS basics

CSS: Layout Part 2. clear. CSS for layout and formatting: clear

ID1354 Internet Applications

INTERNET!!!11!1. Beyond the Mouse A Short Course on Programming. 10b. HTML/CSS or: I m on the. Ronni Grapenthin. November 13, 2011

HTML/XML. HTML Continued Introduction to CSS

CSS exercise - Part 1

NAVIGATION INSTRUCTIONS

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

ITNP43: HTML Lecture 4

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

Building Page Layouts

Transcription:

MODULE 5 INTRODUCTION TO CSS Topics > Cascading Style Sheets (CSS3) Basics Adding a Style Sheet Selectors Adding Dynamic Styles to Elements CSS3 Properties CSS3 Box Model Vendor Prefixes

Cascading Style Sheets (CSS) > CSS rule syntax: selector { property_one: value_one; property_two: value_two; > Applying a style: selector /* Comments in a style sheet */ h1 { background-color: white; color: red; property value new line semicolon Cascading Style Sheets (CSS) > Overriding a rule: h1 { background-color: red!important;

1. Inline style: Adding CSS to HTML <h1 style="color:red;">the Next Big Conference for Front-End Developers</h1> 2. Embedded style: <head> <style> h1 { color: red; </style> </head> Adding CSS to HTML 3. Adding a style sheet: <!DOCTYPE html> <html> <head> <title>the Next Big Front-End Conference</title> <meta charset="utf-8"> <link rel="stylesheet" href="styles.css" /> <script src="code.js"></script> </head> <body> </body> </html> <style> @import url(style.css); </style>

Selectors 1. Element type selectors: p { color: blue; font-size: 1.4em; Multiple selectors: p, h2 { text-transform: capitalize; Child selectors: aside p { color: pink; Only those <p> descendants of <aside> 2. Class selectors:.copyright { font-size: smaller; Multiple classes:.copyright.user-groups { font-size: smaller; 3. ID selectors: Selectors #section-1 { color: green;

Combinators > Universal selectors: * { color: blue; > Descendant selector: #section-2 p { font-weight: bold; > Child selectors: #section-2 > article > header > h1 { color: red; Combinators > Adjacent sibling selectors: h1 + p { color: purple; > General sibling selector: header ~ p { color: orange;

> Syntax: Attribute Selectors E[attr] E[attr=val] > Example of attribute: input[required] { background-color: yellow; > Example of attribute value: input[type="email"] { border: 1px dashed black; > Syntax: E[attr^=val] E[attr*=val] E[attr$=val] Attribute Selectors // Starts with // Contains // Ends with > Starts with example: a[href^="#section-"] { color: red; > Contains an example: a[href*="tion-"] { color: orange;

Pseudo-Class Selectors Pseudo-class :link :visited :hover :active :focus :enabled :checked Matches Any link that the user has not visited yet Any visited link A link as the user passes the cursor over it An element being activated by the user An element that has the focus Any element in enabled state Radio option or check box in selected state Pseudo-Class Selectors Pseudo-class :target :first-child :last-child :nth-child(n) :nth-of-type(n) :root :not Matches Target elements The first child of an element The last child of an element The n child of an element The n child of a particular type, of its parent The element that is the root of the document An element not represented by its argument

Pseudo-Element Selectors Pseudo-Element ::first-line ::first-letter ::before ::after Matches The first line of a given element The first letter of an element Add content preceding a given element Add generated content after an element Adding Dynamic Styles to Elements > On hover: input[type=submit]:hover { cursor: pointer; > On focus: input[type=text]:focus { background-color: lightyellow; > On active: a:active { font-size:150%;

CSS3 Properties: Fonts generic font family p { font-family: "Trebuchet MS", Verdana, sans-serif; > @font-face: @font-face { font-family: "my paragraphtext"; src: url(webfont.woff) format("woff"), url(webfont.ttf) format("truetype"); p { font-size: 12px; font-family: "my paragraphtext", Helvetica, sans-serif; font-weight: normal; generic font family > RGB Color: CSS3 Properties: Colors p { color: #800000; // or color: maroon; color: rgb(128, 0, 0); // in functional notation color: rgba(128, 0, 0, 0.5);// rgb with transparency > HSL: Try this code in JSConsole. p { color: hsl(0, 100%, 25%); // maroon color: hsla(0, 100%, 25%, 0.5); // maroon with // transparency

CSS Box Model The Box top left border content Text margin right padding bottom CSS Box Model

Display, Alignment, and Position float: right; float: left; Example: Box Model > Use the JSConsole web application and run the following example to change some CSS properties for an element on the web page. > Time Limit: 5 minutes Try this section in JSConsole.

Vendor Prefixes Prefix Browser Examples -ms- Microsoft.mySelector { -moz-border-image:url(border.png) 30 30 repeat; /* Firefox */ -moz- Mozilla -webkit-border-image:url(border.png) 30 30 repeat; /* Safari */ -o- Opera -o-border-image:url(border.png) 30 30 repeat; /* Opera */ -webkit- Safari and Chrome border-image:url(border.png) 30 30 repeat;