Today’s objectives Layouts | floats Measurement units Type properties

Slides:



Advertisements
Similar presentations
Advance CSS (Menu and Layout) Miftahul Huda. CSS Navigation MENU It's truly remarkable what can be achieved through CSS, especially with navigation menus.
Advertisements

Unit 20 - Client Side Customisation of Web Pages
Tutorial 4: Creating page layout with css
Stylin’ with CSS. 2 Topics What is CSS? Why CSS? CSS Examples.
WEB DESIGN Multimedia and Web. Today’s Objectives  Quick review selector types  Layout and positioning.
CS4370/6370 Web Development Cascading Style Sheets (CSS)
Week 7 Web Typography. 2 Understanding Type Design Principles.
Basics of Web Design Chapter 6 More CSS Basics Key Concepts 1.
Text Properties, Line Box, CSS. Text Properties Properties related to the display of text. Text-align : left, right, center I like FSU!
Cascading Style Sheets SP.772 May 6, CSS Useful for creating one unified look for an entire web site. Helps to seperate style from content. Can.
Web Design & Development Cascading Style Sheets (CSS)
Beginning Web Site Creation: Dreamweaver CS4. XHTMLCSS  Describes the structure  Content  Collection of styles  Formatting body { background-color:
Using Cascading Style Sheets CSS Structure. Goals Understand how contextual, class and ID selectors work Understand how contextual, class and ID selectors.
W EB S ITE L ECTURE C ASCADING S TYLE S HEETS. Cascading Style Sheets (CSS) Introduction CSS Objectives – Provide more control over web site content presentation.
Stylin’ with CSS. 2 Topics What is CSS? Why CSS? CSS Examples.
Formatting Text (Plus More Selectors) Learning Web Design: Chapter 12.
Web Design – Sec 4-6 and 4-7 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course materials.
Tutorial #8 – Creating Data Tables. Tutorial #6 Review – Layouts Two Column Fixed Width, Three Column Fixed Width Class VS. ID Container Universal Selector.
CSS Box Model. What is the CSS Box Model? The “Box Model” is a tool we use to lay out our web pages in a number of individual "boxes" or "containers".
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.
ITP 104.  While you can do things like this:  Better to use styles instead:
Principles of Web Design 6 th Edition Chapter 10 – Data Tables.
Cascading Style Sheets CSS. CSS - Structure Declaration block Property: identifies what to change Value: how to change it Selector – example h1{ font-size:
Web Development & Design Foundations with XHTML
Chapter 12 Cascading Style Sheets: Part II The Web Warrior Guide to Web Design Technologies.
MCS 270 Cascading Style Sheets (CSS) Gustavus Adolphus College.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
CIS67 Foundations for Creating Web Pages Professor Al Fichera Rev. September 14, 2010—All HTML code brought to XHTML standards. Reference for CIS127 and.
Cascading Style Sheets Chapter Four. What are they? A set of style rules that tell the web browser how to present a web page or document. Cascading Style.
Class three: CSS review, backgrounds, font formatting, the box model.
Stylin’ with CSS Monday October 8 th and Tuesday October 9 th.
CSS Cascading Style Sheets. CSS Advantages Greater typography and page layout control Style is separate from structure Styles can be stored in a separate.
Fonts The following CSS properties will be described: 1.Font-family 2.Font-style 3.Font-variant 4.Font-weight 5.Font-size 6.Font.
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.
Basics of Web Design Chapter 6 More CSS Basics Key Concepts.
Creating Your Own Webpage COSC Cascading Stylesheets Think of: HTML: content of your webpage HTML has tags CSS: presentation and appearance of your.
CSS WORKSHOP Design Principles for Web Standards.
 Cascading Style Sheets (CSS) ◦ Used to specify the presentation of elements separately from the structure of the document.  Inline style ◦ declare.
Web Design I Spring 2009 Kevin Cole Gallaudet University
A really fairly simple guide to: mobile browser-based application development (part 2, CSS) Chris Greenhalgh G54UBI / Chris Greenhalgh
Cascading Style Sheets Level 2. Course Objectives, Session 1 Level 1 Quick Review Chapter 8: Adding Graphics to Web Pages Chapter 9: Sprucing Up Your.
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
CIS234A Lecture 5 Instructor Greg D’Andrea. Font Styles Review Font-Family: generic family, font family Font-Size: em, pt, px, %, mm, cm, in Font-Style:
Microsoft Expression Web-Illustrated Unit F: Enhancing a Design with CSS.
Web Development & Design Foundations with XHTML Chapter 6 Key Concepts.
CONTROLLING Page layout
Developing Web Applications with HTML and CSS “Selectors and Properties”
Page Layout CHAPTER 5 1 CHARLES WYKE-SMITH: STYLIN’ WITH CSS: A DESIGNER’S GUIDE (3 ND EDITION)
CSS Fonts. The Font properties allow you to change the font family, boldness, size, and the style of a text.
Today’s objectives  Announcements  Positioning  Measurement units.
Creating Layouts with CSS. Span tag Here is some underlined text. Here is some blinking text. Here's some bold text.
Class & ID Selectors, Font and List Properties. Id Selectors  # followed by Id-name (without space)  Can be used once on a page  Examples: #p1 { color:
Basic Webpage Design Cascading Style Sheet (CSS).
PERSPECTIVES: TUTORIAL 4 CREATING PAGE LAYOUTS WITH CSS.
03 CSS (Cascading StyleSheet) Р.Жавхлан МОНГОЛ УЛСЫН ИХ СУРГУУЛЬ Мэдээллийн технологийн сургууль Интернэт технологийн үндэс 2015 Намар.
Chapter 11 & 12 CSS Style Sheets: Intro. Why CSS? Separate presentation from content – more accessible Less work – can change appearance of whole site.
Chapter 7.  Change body and link styles  Create a drop-down menu  Change color and font styles in the menu  Create a pop-up effect using CSS  Utilize.
CS 120: Introduction to Web Programming Lecture 10: Extra Features and Website Design Part 1 Tarik Booker CS 120 California State University, Los Angeles.
1 CS428 Web Engineering Lecture 07 Font, Text & Background (CSS - II)
Formatting Text with HTML and CSS. Summary block-level elements. Character-level elements Logical and physical style Special elements: hr,address, quotation.
CSS Details Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  To use CSS properties for fonts  Evaluate whether to use pts,
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,
>> CSS Layouts. Recall Properties of Box – Border (style, width, color) – Padding – Margin – Display – Background – Dimension Welcome Padding Area Border.
CSS Box Model.
The Internet 10/13/11 The Box Model
Laying out Elements with CSS
CSS Box Model.
CSS Box Model.
Positioning Boxes Using CSS
Presentation transcript:

Today’s objectives Layouts | floats Measurement units Type properties Hierarchy Page Box width | border-box Sprites Navigation | Table

Layouts

Types of Layouts Fixed Width - regardless of the browser window’s width, the page content’s width remains the same. Fluid. Design adjusts to fit the browser’s width— whatever it may be. (http://css-tricks.com/) Elastic. A fixed width with type size flexibility. Define page’s width using em values. An em changes size when the browser’s font size changes, page width is based on the browser’s base font size. (http://www.msn.com/)

<div id=“wrapper”> <header id=“banner”> </header> <nav id=“main-nav”> </nav> <div id=”main-content”> </div> <footer id=“site-info”> </footer>

Normal Flow <html> <body> Div id=“wrapper” HEADER id=“banner” NAV id=“main-nav” DIV id=“main-content” FOOTER id=“site-info” <body> <html>

DIV id = wrapper HEADER id = banner NAV id = main-nav DIV id = main-content FLOAT LEFT FOOTER id = site-info

DIV id = wrapper HEADER id = banner NAV id = main-nav DIV id = main-content <style> #wrapper,#banner,#main-nav, #main-content, #site-info {padding:10px;} #wrapper {border:1px solid #0C0;background-color:#F90;} #banner {border:1px solid #0C0; background-color:#099;} #main-nav { border:1px solid #099; background-color:#069; width:200px; float:left; } #main-content { border:1px solid #03F; background-color:#09C; margin-left:222px; #site-info {border:1px solid #933; background-color:#CC9;} </style> FLOAT LEFT FOOTER id = site-info

L Normal Flow FLOAT LEFT 1. BANNER 2. NAVIGATION 3. CONTENT 1.BANNER 2

R Normal Flow FLOAT RIGHT 1. BANNER 1.BANNER 2. NAVIGATION 3.CONTENT 2

L L R Normal Flow FLOAT Left & RIGHT 1. BANNER 1.BANNER 2. NAVIGATION 3.CONTENT 4 3. CONTENT L L R 4. EVENTS

L L R R Normal Flow FLOAT Left & RIGHT 1. BANNER 1.BANNER 2. COL WRAPPER 2. COL WRAPPER L 2 Col wrapper 2 3. CONTENT 4 3.CONTENT 5 L R R 4. NAVIGATION 5. EVENTS

Widths and heights

Height and width properties Assign a height and width to the content area of a style. width: 20em; width: 30%; height: 300px;

Height and width properties min-height - min-height: 4em; min-width - min-width: 800px; max-height - max-height: 50px; max-width - max-width: 940px; Often use the max-width and min-width properties in conjunction when creating fluid layouts.

Height and width properties The general rule of thumb is NOT to sets heights on a pages. BANNER Height: 150px; Nav CONTENT Ads Height: 550px;

Height and width properties Width given by the web browser is the total of the widths of the margins, borders, padding, and width properties. If you set the following properties: width: 800px; padding: 15px; border-width: 5px; margin: 10px Total width = 830px

Content #wrapper { width: 800px; padding: 15px; border-width: 5px; } Padding and Border add to the overall width of an element <div id=“wrapper”> PADDING Content #wrapper { width: 800px; padding: 15px; border-width: 5px; } PADDING PADDING Total width = 820px </div> PADDING

Height and width properties Source: CSS: The missing manual. (2009). David Sawyer McFarland, Oreilly, p.166.

Step 1 Step 2 #wrapper {width:300px;} p {width:100px; float: left; padding:0;} <div id="wrapper"> <p>1</p> <p>2</p> <p>3</p> </div> #wrapper {width:300px;} p {width:100px; float: left; padding:10px;} <div id="wrapper"> <p>1</p> <p>2</p> <p>3</p> </div> <div id="wrapper"> <div id="wrapper"> Padding added 1 2 1 2 3 3 </div> </div>

Step 1 Step 2 #wrapper {width:300px;} p {width:100px; float: left; padding:0;} <div id="wrapper"> <p>1</p> <p>2</p> <p>3</p> </div> #wrapper {width:300px;} p {width:100px; float: left; padding:10px; -moz-box-sizing:border-box; -webkit-box-sizing:border-box; box-sizing:border-box; } <div id="wrapper"> <p>1</p> <p>2</p> <p>3</p> </div> Padding added to inside of box without increasing overall size of box <div id="wrapper"> <div id="wrapper"> 1 2 3 1 2 3 </div> </div>

Measurement units

Pixels Using Pixels Independent from any browser settings. Fixed size Specify 55-pixel font size for an <h2> element, the web browser displays text that’s 55 pixels tall.   p {font-size: 36px;}

Using Keywords, Percentages, and Ems Keywords, percentages, and ems add to or subtract from base text size.   Most browsers text displayed 16 pixels tall - base text size. When resizing text, browser uses base text size (e.g., 16 pixels) and adjusts it according to keyword, em, or percentage value.

Keyword Seven keywords assign a size that’s relative to the base text size: xx-small, x-small, small, medium, large, x-large, and xx-large. p { font-size: large;}   Medium is the same as browser’s base font size. Each of options decreases or increases the size by a different factor.

Keyword xx-small is equivalent of 9 pixels (assuming base font size is 16 pixels) x-small is 10 pixels small is 13 pixels medium is 16 pixels large is 18 pixels x-large is 24 pixels xx-large is 32 pixels

Percentages Adjust text in relationship to base text size. Give finer control than keywords. Base text size for a browser is equivalent to 100%. Font-size to 100% = 16 pixels (usually).

I think, all type in P elements will be 100% of default browser type size of 16px – so any type in a P element will sized at 16px. div {font-size:200%} p {font-size: 100%;} <div> Content <p>Hello World</p> </div> I think, all type in P elements will be 50% of default browser type size of 16px – so any type in a P element will be sized at 8px. div {font-size:200%} p {font-size: 50%;} <div> Content <p>Hello World</p> </div>

Content Content Hello World How it looks in browser div {font-size:200%} p {font-size: 100%;} Content Hello World <div> Content <p>Hello World</p> </div> How it looks in browser div {font-size:200%} p {font-size: 50%;} Content Hello World <div> Content <p>Hello World</p> </div>

Context is important here! How it looks in browser div {font-size:200%} p {font-size: 100%;} Content Hello World <div> Content <p>Hello World</p> </div> Text in P element is same size as text in DIV????? 200% of default font size of 16px = 32px 100% of 32px = 32px How it looks in browser div {font-size:200%} p {font-size: 50%;} Content Hello World <div> Content <p>Hello World</p> </div> Text in P element is 50% the size of text in DIV. 50% of 200% = 100% or 50% of 32px = 16px Context is important here!

Ems EM and percent work the same. 1em equals a value of 100%. A percentage value - same as em multiplied by 100. .8em is 80 percent, .55em is 55 percent, 2em is 200%, and so on. font-size: 80% is same as font-size: .8em Em units are preferred for type because em is topographical unit of measure.

CSS Typography font-family font-style font-variant font-weight Five properties control font characteristics font-family font-style font-variant font-weight font-size

font-family Value is a list of font names in decreasing order of preference – the font stack. p { font-family: "The Sans", verdana, helvetica, sans-serif } Names separated by a space should be in “ “

font-style & font-variant font-style may be normal, italic or oblique (i.e. slanted) font-variant may be normal or small-caps

font-weight Values normal and bold have expected effect Many font families have more than two weights, with no standard names font-weight may be 100, 200,…, 900

font-size Sizes relative to browser default may be chosen from xx-small, x-small, small, medium, large, x-large, xx-large Sizes may be a percentage of inherited value, or specified in em units of inherited font

Leading line-height property specifies leading Use percentage (150%), ratio (1.5) or ems (1.5em) to specify leading relative to font size

Alignment text-align property can take values left, right, center or justify body { text-align: left } p.display { text-align: center }