Basics of Smarajit Dasgupta.

Slides:



Advertisements
Similar presentations
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
Advertisements

Making Things Look Nice: Visual Appearance and CSS CMPT 281.
Cascading Style Sheets. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. CSS is a.
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
CIS 1310 – HTML & CSS 6 Layout. CIS 1310 – HTML & CSS Learning Outcomes  Describe & Apply the CSS Box Model  Configure Float with CSS  Designate Positioning.
CSS normally control the html elements. Three Ways to Insert CSS There are three ways of inserting a style sheet: External style sheet Internal style.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 6 - Cascading Style Sheets™ (CSS) Outline 6.1 Introduction 6.2 Inline Styles 6.3 Embedded Style.
CS4370/6370 Web Development Cascading Style Sheets (CSS)
Web Design & Development Cascading Style Sheets (CSS)
CS134 Web Design & Development Cascading Style Sheets (CSS) Mehmud Abliz.
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
Working with Cascading Style Sheets. 2 Objectives Introducing Cascading Style Sheets Using Inline Styles Using Embedded Styles Using an External Style.
CSS (Cascading Style Sheets): How the web is styled Create Rules that specify how the content of an HTML Element should appear. CSS controls how your web.
Cascading Style Sheets 1 Color and Backgrounds. Cascading Style Sheets 2 Color and Backgrounds Computer color basics Expression of color values using.
Principles of Web Design 6 th Edition Chapter 4 – Cascading Style Sheets.
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
Cascading Style Sheets CS3505. What are CSS? Method for adding style attributes consistently to HML tags Cascading because styles are applied in order.
Cascading Style Sheets Billy Toy Cascading Style Sheets Syntax review How to Implement style sheets Background properties Text properties.
XP Tutorial 7New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks.
HTML - Quiz #2 Attendance CODE:
Dreamweaver -- CSS. Dreamweaver -- MX New icons are added in MX Most of the features commonly used in web design, and are same as FrontPage. New feature.
Week 4.  Three ways to apply CSS: Inline CSS Internal style sheets ( header style information) External style sheets.
CS105 INTRODUCTION TO COMPUTER CONCEPTS CASCADING STYLE SHEETS (CSS) Instructor: Cuong (Charlie) Pham.
CSS Positioning Creating Special Effects with CSS CS202 Working with Cascading Style Sheets (Chapter 4) CS202 1.
Cascading Style Sheets. Defines the presentation of one or more web pages Similar to a template Can control the appearance of an entire web site giving.
Today’s objectives  Review  CSS | Rules | Declarations  HTML Structure document  Class asignment.
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorials 3 & 4: Working With CSS.
Cascading Style Sheet Bayu Priyambadha, S.Kom. Definition Cascading Style Sheets (CSS) form the presentation layer of the user interface. –Structure (HTML)
11/6/13 MORE CSS!. TODAY’S AGENDA Review: float for positioning objects Review: CSS and color Introductions to: o CSS and images o CSS backgrounds o CSS.
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
MySQL and PHP Review CSS. Cascading Style Sheet (CSS) Style sheets are files or forms that describe the layout and appearance of a document. Cascading.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Tutorial 7.
Lecture 2 - HTML and CSS Review SFDV3011 – Advanced Web Development 1.
Lesson 03 // Cascading Style Sheets. CSS Stands for Cascading Style Sheets. We’ll be using a combination of Html and CSS to create websites. CSS is a.
Advanced Cascading Style Sheets (CSS) Lecture # July 2013.
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
CSS WORKSHOP Design Principles for Web Standards.
>> The “Box” Model. Pre-requisite Create a new project in Netbeans called Week5 Create a new html file and name it box.html Create a new css file and.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 6 - Cascading Style Sheets™ (CSS) Outline 6.1 Introduction 6.2 Inline Styles 6.3 Embedded Style.
 Cascading Style Sheets (CSS) ◦ Used to specify the presentation of elements separately from the structure of the document.  Inline style ◦ declare.
So far, we have looked at CSS selectors that correlate with HTML tags Now, we’ll see how you can define your own selectors using class and ID selectors.
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
CSS  Basic rules of CSS  Pseudo-class of the A tag  Apply CSS to alter an unordered list Cascading Style Sheets (CSS)
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
CNIT 132 – Week 4 Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of.
3.2 Cascading Style Sheets. 2 Positioning Elements Normally, elements are laid out on the page in the order that they are defined in the XHTML document.
Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.
Lecture 2: Cascading Style Sheets (CSS) Instructor: Dr. M. Anwar Hossain.
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
Extra-simplified.  Only truly happen when the CSS and HTML are defined as separate files (external style sheet) Introduction The main idea of CSS is.
5 th ed: Chapter 4 4 th ed: Chapter 5 SY306 Web and Databases for Cyber Operations SlideSet #5: Advanced CSS.
CSS - Quiz #3 Lecture Code:
CSS: Cascading Style Sheets Part II. Style Syntax.
BEGINNER WEB DESIGN. INTRODUCTION Vocabulary Design Tools of the Trade HTML CSS.
CIS 228 The Internet 10/18/11 Grouping XHTML. CSS Selectors Rule: selector-group { property-declaration* } Selector-group: selector *, Selector: simple-selector.
Tutorial #5 Working with the Box Model. Tutorial #4 Review - CSS Create a homework page Final Project Discussion Exam on Blackboard Styling Lists (List-style-type,
PERSPECTIVES: TUTORIAL 4 CREATING PAGE LAYOUTS WITH CSS.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
1 CS428 Web Engineering Lecture 07 Font, Text & Background (CSS - II)
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
HTML & CSS Contents: the different ways we can use to apply CSS to The HTML documents CSS Colors and Background CSS Fonts CSS Text CSS box model: padding,
WebD Introduction to CSS By Manik Rastogi.
Working with Cascading Style Sheets
>> The “Box” Model
CSS Borders and Margins.
The Internet 10/20/11 CSS Layout
Presentation transcript:

Basics of Smarajit Dasgupta

Cascading Style Sheets, or CSS, is the recommended way to control the presentation layer in a web document. Style declarations cascade down to elements from many origins. Inline, embedded and External CSS

 CSS1 – 1994  CSS2 – 1998  CSS2.1 came into being because some parts of CSS2 was very difficult to implement  CSS3 is still being developed, but already in use (will discuss in detail later)

Using url(/style.css); Using link linked -> imported -> embedded -> inline

 Those 2 words, ‘block’ and ‘inline’ are explicit enough by themselves.. block: an element which forms a separate block, …,,,,,,,  inline: an element which stays inline with the rest of the content,,,,,, Inline-block CSS Box Model & CSS Box Model Hack  The box model applies to block-level elements.  2 hacks : clear: both; and overflow : hidden;  Border and outline difference

 Eric Meyer’s CSS reset dex.html dex.html  ID v Class Use class for any “label” that might show up more than once in a page, and id for anything that will appear only once Padding, margin, units (em, px, %) Positioning: absolute, relative, fixed Techniques like : image replacement and CSS sprites Inheritence - process by which properties are passed from parent to child elements even though those properties have not been explicitly defined by other means.

 Some properties can be combined into shorthand notation  margin: 1em 2em 3em 4em; Tips to remember : Top, Right, Bottom, Left (TRouBLe) OR Read clockwise  background: #fff url(bg.png) no-repeat fixed right top; Is equivalent to: background-color: #fff; background-image: url(bg.png); background-repeat: no-repeat; background-attachment: fixed; background-position: right top;  Font & border shorthand

 Attributes (case-sensitive) input[type="submit"] { declarations } a[href] { declarations } div[class~="warning"] {  attribute selection of class declarations } div[class="warning"] img[src="/img/2010/mainlogo.png"]  You don’t need to class or ID it or anything else  img[alt~="figure"]  Any image whose alternate text contains the word “fi gure”  table[summary~="data"]  Any table whose summary text contains the word “data”  *[title~="2009"]  Any element whose title text contains the word “2009”  a[href=" and a[href*="w3.org"] {font-weight: bold;}

If you want to select based on a substring at the beginning of an attribute value, use this pattern: a[href^="http"] In order to select based on a substring at the end of an attribute value, use this pattern: a[href$=".pdf"] Other ideas of using attributes  a[href^="https"] Secure-server links  a[href^="mailto"] contact links  a[href^="aim"] AOL Instant Messenger service links  a[href$=".doc"] Microsoft Word documents  a[href$=".xls"] Microsoft Excel documents  a[href$=".zip"] Zip archives

 Partial Child selection div#main > div {border: 1px solid gray;}  SIBLING SELECTION h2 + p {margin-top: 0;}  remove the top margin from any paragraph that immediately follows an h1  h1 ~ ul {list-style-type: lower-alpha;}  Figure selection of elements that are following siblings, but not immediately adjacent following sibling

 IE9.js (a JS library to make Microsoft Internet Explorer behave like a standards-compliant browser. It fixes many HTML and CSS issues and makes transparent PNG work correctly under IE5 and IE6. )

Specificity is a numeric representation of the “specific-ness” of a selector. Every element descriptor contributes 0,0,0,1. Every class, pseudo-class, or attribute descriptor contributes 0,0,1,0. Every ID descriptor contributes 0,1,0,0. ul li {font- style: normal;} html li {font- style: italic;} If two selectors have same specificity, the one written later will get preference. The proximity to the element being selected does not matter

 UNIVERSAL SELECTION * {color: blue;} /*specificity 0,0,0,0*/ div * {border: 1px solid red;} /*specificity 0,0,0,1*/ p#lead-in {font-weight: bold;} p[id="lead-in"] {font-weight: normal; font-style: italic;} Stretch bg image #img.source-image { width: 100%; position: absolute; top: 0; left: 0; z-index:-1; }