Copenhagen, 6 December 2004 Modern CSS Principles Miruna Bădescu Finsiel Romania.

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 3-1 Created by Cheryl M. Hughes The Web Wizards Guide to XML by Cheryl M. Hughes.
Advertisements

LIS650 lecture 4 Thomas Krichel today CSS Properties –Box properties-- List properties –Table properties-- Classification properties –(Audio.
LIS650 lecture 4 Thomas Krichel today Advice CSS Properties –Box properties –List properties –Classification properties Fun with selectors.
© 2010 Delmar, Cengage Learning Chapter 9 Positioning Objects with AP Div Tags.
HIGH LEVEL OVERVIEW: CSS CSS SYNTAX CONSISTS OF A SET OF RULES THAT HAVE 3 PARTS: A SELECTOR, A PROPERTY, AND A VALUE. IT’S NOT NECESSARY TO REMEMBER THIS.
Week 10 Creating Positioned Layouts
15 LAYOUT Controlling the position of elements Creating site layouts Designing for different sized screens.
Chapter 11 Creating Framed Layouts Principles of Web Design, 4 th Edition.
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
CSS Layout Crash Course An Advance CSS Tutorial. Inline vs. Block Many HTML elements have a default display setting of Block. Block elements take up the.
Cascading Style Sheets
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Part 5 Introduction to CSS. CSS Display - Block and Inline Elements A block element is an element that takes up the full width available, and has a line.
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.
© 2004, Robert K. Moniot Chapter 6 CSS : Cascading Style Sheets.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
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.
Recognizing the Benefits of Using CSS 1. The Evolution of CSS CSS was developed to standardize display information CSS was slow to be supported by browsers.
CSS(Cascading Style Sheets )
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
กระบวนวิชา CSS. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
© 2010, Robert K. Moniot Chapter 5 CSS : Cascading Style Sheets 1.
ADVANCED CSS William Neely CEO, Piecewise.com. CSS FONTS AND TEXT CSS ‣ Line-height allows to indicate the amount of space between lines; allows for equal.
Using CSS for Page Layout. Types of HTML Elements Block-Level Element –Creates blocks of content e.g. div, h1..h6, p, ul, ol, li, table, form –They start.
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
MORE Cascading Style Sheets (The Positioning Model)
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.
Using Cascading Style Sheets. Introduction to Styles and Properties  Cascading Style Sheets (CSS) are a standard set by the World Wide Web Consortium.
Chapter 7 Web Typography Principles of Web Design, 4 th Edition.
Cascading Style Sheet (CSS)
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.
1 Cascading Style Sheets (CSS) Part 2. 2 The Sources of Style Sheets.
Lecture 2 - HTML and CSS Review SFDV3011 – Advanced Web Development 1.
Cascading Style Sheets Eugenia Fernandez IUPUI. CSS Purpose CSS allow you to specify the style in which your XML elements are displayed. CSS were originally.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
THE BOX MODEL Putting layouts together with CSS. The Box Model  How would you describe a box?  Container?  Tags or elements are “containers”  puts.
1 Working with Cascading Style Sheet (CSS). 2 Cascading Style Sheets (CSS)  a style defines the appearance of a document element. o E.g., font size,
CSS: Cascading Style Sheets Part II. Style Syntax.
Understanding CSS Cascading Style Sheets control the presentation of content in HTML pages Style Sheets separate formatting from the content –Styles defined.
Internet & World Wide Web How to Program, 5/e 1. 2.
CSS.
Laying out Elements with CSS
Working with Cascading Style Sheets
Cascading Style Sheets Layout
Cascading Style Sheets™ (CSS)
Webpage layout using CSS
Using Cascading Style Sheets Module B: CSS Structure
Web Systems & Technologies
Cascading Style Sheets
CSS Applications to XML 19-Sep-18.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
6 Layout.
Second CSS Lecture Applications to XML
MORE Cascading Style Sheets (The Positioning Model)
What are Cascading Stylesheets (CSS)?
Web Development & Design Foundations with H T M L 5
Cascading Style Sheets™ (CSS)
More CSS 22-Feb-19.
Tutorial 4 Creating Special Effects with CSS
The Internet 10/20/11 CSS Layout
Cascading Style Sheets
CSS Applications to XML 20-May-19.
CSS Applications to XML 3-Jul-19.
Cascading Style Sheets™ (CSS)
Presentation transcript:

Copenhagen, 6 December 2004 Modern CSS Principles Miruna Bădescu Finsiel Romania

2 Result: Programmer Web designer Conclusion: both of them must know and follow (the same) standards from the beginning Authoring Web pages scenario ProgrammerWeb designer makes nice layout breaks it into HTML and CSS integrates layout in dynamic pages validates pages (WAI, CSS, etc.) improves HTML and CSS goes back to the designer… Your layout looks terrible! This is not my design!

3 Designing with tables Designers like it a lot allows accurate control over the layout with down to pixel-level they have tools (from Macromedia, Corel, Adobe Photoshop, etc.) that slice a picture into a Web page (HTML and CSS) End users suffer long loading time poor accessibility Programmers dont enjoy it hard to maintain longer code Search engine get confused its not semantically correct

4 Use CSS instead Standard for Web design Separates the content from its appearance Allows information to be presented differently according to: the target media (screen, printer, aural, small screens, etc.) clients settings (alternative layouts, text browsers, etc.)

5 Adding styles to pages (1) 1.Inline CSS handy, but dont abuse it because it puts presentation back with the content

6 Adding styles to pages (2) 2.Embedded CSS better, but makes code longer and less visible same style downloaded on clients machine multiple times style-sheet declaration

7 Adding styles to pages (3) 3.External CSS easier to read and modify downloaded once for all website pages separates content from presentation – the way to go sample.html sample_style.css

8 CSS rule Selector Values Properties

9 HTML documents are parsed into a document tree Example: Inheritance in CSS html head body title meta link h1 p ul li used when building CCS rules some properties (e.g. font-family) are inherited from parents if not specified

10 Types of selectors (1) 1.universal selector (CSS2) applies to: all elements in a page e.g.: * { color: red } 2.element type selector applies to: all elements of that type from a page (standard tags) e.g.: h2 { color: red } 3.class selector applies to: elements defined with that class e.g.:.sitetitle { color: red } HTML: …

11 Types of selectors (2) 4.ID selector applies to: the single element with that id from the page e.g.: #content { color: red } HTML: … 5.pseudo-element selector (CSS2) applies to: the first letter, line or child of the nominated element e.g.: p:first-letter { color: red } 6.pseudo-class selector (CSS2) applies to: the nominated element in certain conditions e.g.: a:hover { color: red } applies to: all element in a certain language e.g.: :lang(ro) { text-decoration: underline } HTML: …

12 Types of selectors (3) 7.descendant selector applies to: an element that is a child of another element e.g.: p strong { color: red } HTML: This paragraph is long… 8.parent-child selector (CSS2) applies to: an element that is a strict child of another element e.g.: body > p { color: red }

13 Types of selectors (4) 9.adjacent selector (CSS2) applies to: an element that appears in the code right after another e.g.:p + span { color: red } HTML: This is a paragraph. this one will be red this one not 10.attribute selector (CSS2) applies to: elements that have a property specified or specified with a certain value e.g.: input[type=text] { color: red }

14 The box model top right left bottom Content border padding margin (transparent)

15 Where does it apply For display purposes, every element in a document is considered to be a rectangular box which has a content are surrounded by padding, a border and margins

16 Example: Defining an unordered list style: And writing the HTML code:

17 Results in:

18 The display property Most used values for specifying the display type of an element: block – shows a separate block e.g. default style for h1, p, form, div inline – displays inside a text fragment e.g. default style for span, em, code list-item – used for lists e.g. default style for li none can be applied to any element doesnt show the element or the space it would take if shown

19 Positioning (1) CSS2 provides four types of positioning schemes: normal default positioning: block boxes flow vertically inline boxes flow horizontally

20 Positioning (2) relative done by browsers in two steps: first, the normal flow is followed the box is moved according to its offset properties (top, right, left, bottom) Notes: use z-index style property to specify their order a specific width property might cause an offset to be ignored Text text text text text text text text text text text text… Text text text text text text text text text text text text… paragraph with relative positioning, with positive top and left values

21 Positioning (3) float specify elements to shift either to the left or right surrounding content flows around the opposite side a width should be specified for a floating box Text text text text text text text text text text text text text Text text Box floating to the right

22 Positioning (4) Note: floating boxes take no space on the vertical side if a floating box is taller than the first surrounding block, it will float around the next block, too solution: clear the floating Text text text text text text Text text text text text text text text text text text Text text text text text text Text text text text text text text text text text text clear: right style for this element

23 Positioning (5) absolute the normal flow does not apply and the element is positioned according to its offset values (top, right, bottom, left) special case: fixed positioning – the containing block is the viewport of the browser window fixed position for this element browser window the rest of the content in the page that must be scrolled

24 Scaling There are two types of lengths units for fonts: relative em: computed value of the font-size ex: x-height px: pixels, relative to the viewing device absolute in: inches cm: centimeters pt: points pc: picas

Validate your CSS

Exercises Modeling a simple page with CSS Demonstrating the box model Scaling an image