Spring 20116.813/6.831 User Interface Design and Implementation1 Lecture 10: Layout.

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

Cascading Style Sheets
Today CSS HTML A project.
CSS CSS Precise Aesthetic Control. Cascading Style Sheets Though they can be put in HTML header, usually a separate page that the HTML links to Contains.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
Principles of Web Design 5 th Edition Chapter Nine Site Navigation.
Cascading Style Sheets By: Valerie Kuna. What are Cascading Style Sheets? Cascading Style Sheets (CSS) are a standard for specifying the presentation.
CSS BASICS. CSS Rules Components of a CSS Rule  Selector: Part of the rule that targets an element to be styled  Declaration: Two or more parts: a.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
กระบวนวิชา 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.
Tutorial 6 Creating Fixed-Width Layouts
Week 7 Web Typography. 2 Understanding Type Design Principles.
Text Properties, Line Box, CSS. Text Properties Properties related to the display of text. Text-align : left, right, center I like FSU!
Beginning Web Site Creation: Dreamweaver CS4. XHTMLCSS  Describes the structure  Content  Collection of styles  Formatting body { background-color:
Lecture Cascading Style Sheets (CSS) Internal Style Sheets Classes.
CSS Basics LIS Webteam April 8, Why CSS? What’s wrong with HTML? Structure vs Style Early web design used hacks to style webpages with HTML – like.
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
Tutorial 4 Creating Special Effects with CSS
Working with Cascading Style Sheets. 2 Objectives Introducing Cascading Style Sheets Using Inline Styles Using Embedded Styles Using an External Style.
Using Cascading Style Sheets. Introduction to Styles and Properties  Cascading Style Sheets (CSS) are a standard set by the World Wide Web Consortium.
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.
LING 408/508: Programming for Linguists
Cascading style sheets (CSS)
Chapter 7 Web Typography Principles of Web Design, 4 th Edition.
Tutorial 4 Creating Special Effects with CSS. XP Objectives Work with CSS selectors Create styles for lists Create and apply class styles Create a rollover.
Tutorial 4 Creating Special Effects with CSS
CSS Positioning Creating Special Effects with CSS CS202 Working with Cascading Style Sheets (Chapter 4) CS202 1.
1 Cascading Style Sheets (CSS) Part 2. 2 The Sources of Style Sheets.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Fall UI Design and Implementation1 Lecture 9: Declarative UI.
CSS. HTML: Looking Back HTML dictates order, structure, and function Does very little to specify layout or visual rendering.
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Tutorial 7.
Css. Definition Cascading style sheet (CSS)  It is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.
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.
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
Chapter 6 Introducing Cascading Style Sheets Principles of Web Design, 4 th Edition.
Cascading Style Sheets Robin Burke ECT 270. Outline Midterm The Layout Debate CSS properties Fonts Alignment Color CSS selection selectors pseudo-classes.
CSS WORKSHOP Design Principles for Web Standards.
Principles of Web Design 6 th Edition Chapter 9 – Site Navigation.
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.
LING 408/508: Programming for Linguists Lecture 10 September 30 th.
Positioning and Printing Creating Special Effects 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.
Tutorial 4 Creating Special Effects with CSS. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Work with CSS selectors.
Tutorial 4 Creating Special Effects with CSS. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Work with CSS selectors.
Tutorial 4 Creating Special Effects with CSS. XP Objectives Work with CSS selectors Create styles for lists Create and apply class styles Create a rollover.
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
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.
CIS67 Foundations for Creating Web Pages Professor Al Fichera Rev. September 22, 2010—All HTML code brought to XHTML standards. Reference for CIS127 and.
Understanding CSS Cascading Style Sheets control the presentation of content in HTML pages Style Sheets separate formatting from the content –Styles defined.
Stylizing a Navigational Menu Web Design Section 6-3 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
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.
HTML 5 AND CSS Dr Mohd Soperi Mohd Zahid Semester /16.
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 3 Introducing Cascading Style Sheets.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
Unit 3 - Review. Topics 1. Tag, Attribute, Value 2. CSS Rule Syntax + link 3. Categories of Selectors 4. Inline vs Block Tags 5. CSS Layout 6. CSS Box.
CSS Introductions. Objectives To take control of the appearance of a Web site by creating style sheets. To use a style sheet to give all the pages of.
CONFIGURING COLOR AND TEXT WITH CSS Chapter 3. Cascading Style Sheets (CSS) Used to configure text, color, and page layout. Launched in 1996 Developed.
CSS.
Laying out Elements with CSS
Working with Cascading Style Sheets
Styles and the Box Model
Floating and Positioning
Presentation transcript:

Spring /6.831 User Interface Design and Implementation1 Lecture 10: Layout

UI Hall of Fame or Shame? Spring /6.831 User Interface Design and Implementation2

Nanoquiz closed book, closed notes submit before time is up (paper or web) we’ll show a timer for the last 20 seconds Spring /6.831 User Interface Design and Implementation

1.In the model-view-controller pattern for graphical user interfaces, the view: (choose all good answers) A. draws itself B. uises a listener to get changes from the controller C. corresponds to a region of the screen D. stores application data 2.Which of the following are reasons why a view and a controller are often hard to disentangle from each other? (choose all good answers) A. a controller depends on its parent in the view tree B.the controller depends on affordances displayed by the view C. the view is a listener on the model D. mouse input is handled by the view 3.Which of the following are advantages of declarative specification of a graphical user interface? (choose all good answers) A. it’s more compact B. debugging with breakpoints is easier C. declarative specifications can be produced by direct-manipulation-style GUI builders Spring /6.831 User Interface Design and Implementation

Today’s Topics CSS Automatic layout Constraints Spring /6.831 User Interface Design and Implementation5

Cascading Style Sheets (CSS) Key idea: separate the structure of the UI (view tree) from details of presentation –HTML is structure, CSS is presentation Two ways to use CSS –As an attribute of a particular HTML element Cut –As a style sheet defining style rules for many HTML elements at once button { font-weight:bold; } Spring /6.831 User Interface Design and Implementation6

CSS Selectors Each rule in a style sheet has a selector pattern that matches a set of HTML elements Tag name button { font-weight:bold; } ID #main { background-color: rgb(100%,100%,100%); } Class attribute.toolbarButton { font-size: 12pt; } Element paths #toolbar button { display: hidden; } Spring /6.831 User Interface Design and Implementation7

Cascading and Inheritance If multiple rules apply to the same element, rules are automatically combined with cascading precedence –Source: browser defaults < web page < user overrides Browser says:a { text-decoration: underline; } Web page says:a { text-decoration: none; } User says:a { text-decoration: underline; } –Rule specificity: general selectors < specific selectors button { font-size: 12pt; }.toolbarButton { font-size: 14pt; } Styles can also be inherited from element ’ s parent –This is the default for simple styles like font, color, and text properties body { font-size: 12pt; } Spring /6.831 User Interface Design and Implementation8

Declarative Styles vs. Procedural Styles CSS // found in a element button { font-size: 12pt; font-weight: bold; } jQuery // in a element $(“button”).css(“font-size”, “12pt”).css(“font-weight”, “bold”); Spring /6.831 User Interface Design and Implementation9

Automatic Layout Layout determines the sizes and positions of components on the screen –Also called geometry in some toolkits Declarative layout –CSS styles Procedural layout –Write Javascript code to compute positions and sizes Spring /6.831 User Interface Design and Implementation10

Reasons to Do Automatic Layout Higher level programming –Shorter, simpler code Adapts to change –Window size –Font size –Widget set (or theme or skin) –Labels (internationalization) –Adding or removing nodes Spring /6.831 User Interface Design and Implementation11

Flow Layout Left-to-right, automatically-wrapping CSS calls this “inline” layout display: inline Many elements use inline layout by default Spring /6.831 User Interface Design and Implementation12 People Places Things New Save Print …

Block Layout Blocks are laid out vertically –display: block –divs default to block layout Inline blocks are laid out in flow –display: inline-block Spring /6.831 User Interface Design and Implementation13 People Places Things New Save Print

Float Layout Float pushes a block to left or right edge Spring /6.831 User Interface Design and Implementation14.navbar { float: left; }.navbar button { display: block; } People Places Things New Save Print

Grid Layout Blocks & floats are typically not enough to enforce all the alignments you want in a UI Use tables instead Spring /6.831 User Interface Design and Implementation15 Name: Groups:

Margins, Borders, & Padding Spring /6.831 User Interface Design and Implementation16 Margin Border Padding Content

Space-Filling & Alignment width: 100%, height: 100% consumes all of the space available in the parent vertical-align moves a node up and down in its parent’s box –baseline is good for lining up labels with textboxes –top and bottom are useful for other purposes Centering –margin: auto for boxes –text-align: center for inlines Spring /6.831 User Interface Design and Implementation17

Absolute Positioning Setting position & size explicitly –in coordinate system of entire window, or of node’s parent –CSS has several units: px, em, ex, pt –mostly useful for popups Spring /6.831 User Interface Design and Implementation18 button { position: absolute; left: 5px; top: 5px; }

Constraints Constraint is a relationship among variables that is automatically maintained by system Constraint propagation: When a variable changes, other variables are automatically changed to satisfy constraint Spring /6.831 User Interface Design and Implementation19

Using Constraints for Layout Spring /6.831 User Interface Design and Implementation20 Label1 Textbox Label2 label1.left = 5 label1.width = textwidth(label1.text, label1.font) label1.right = textbox.left label1.left + label1.width = label1.right textbox.width >= parent.width / 2 textbox.right <= label2.left label2.right = parent.width

Using Constraints for Behavior Input –checker.(x,y) = mouse.(x,y) if mouse.button1 && mouse.(x,y) in checker Output –checker.dropShadow.visible = mouse.button1 && mouse.(x,y) in checker Interactions between components –deleteButton.enabled = (textbox.selection != null) Connecting view to model –checker.x = board.find(checker).column * 50 Spring /6.831 User Interface Design and Implementation21

Constraints Are Declarative UI Spring /6.831 User Interface Design and Implementation22 -scrollpane.child.y scrollpane.child.height – scrollpane.height scrollbar.thumb.y scrollbar.track.height – scrollbar.thumb.height =

Summary Automatic layout adapts to different platforms and UI changes CSS for layout Constraints are useful for more than just layout Spring /6.831 User Interface Design and Implementation23