CONTROLLING Page layout

Slides:



Advertisements
Similar presentations
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.
Advertisements

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.
Chapter 7 Page Layout Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Advance CSS (Menu and Layout) Miftahul Huda. CSS Navigation MENU It's truly remarkable what can be achieved through CSS, especially with navigation menus.
CIS 1310 – HTML & CSS 6 Layout. CIS 1310 – HTML & CSS Learning Outcomes  Describe & Apply the CSS Box Model  Configure Float with CSS  Designate Positioning.
Unit 20 - Client Side Customisation of Web Pages
Tutorial 4: Creating page layout with css
Today’s objectives Site performance Padding, Margins, Borders
Week 9 Using the Box Properties. 9-2 The CSS Visual Formatting Model Describes how the element content boxes should be displayed by the browser –Based.
CSS provides a way to stray away from the traditional methods of using tables to lay out pages. Success with this technique depends on understanding of.
Tutorial 6 Creating Fixed-Width Layouts
TUTORIAL 4: CREATING PAGE LAYOUT WITH CSS Session 4.3.
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
MORE Cascading Style Sheets (The Positioning Model)
Slide 1 of 83 Table Borders To specify table borders in CSS, use the border property. The example below specifies a black border for table, th, and td.
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".
Web Development & Design Foundations with XHTML Chapter 6 Key Concepts.
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.
Cascading Style Sheets CSS. CSS Positioning Normal Flow Top -> bottom | left -> right Arranged in the order they appear in the code make room for one.
Cascading Style Sheets CSS. div … Used like a container to group content Gives context to the elements in the grouping Give it a descriptive name with.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Copyright © Terry Felke-Morris CSS Flow & Positioning 1 Copyright © Terry Felke-Morris.
CSS Netcentric. What is CSS O CSS stands for Cascading Style Sheets O Styles define how to display HTML elements O Styles were added to HTML 4.0 to solve.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Today’s objectives  Assignment 1  Padding, Margins, Borders  Fluid Layout page  Building accessible Table  Element size with padding and border 
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 12: Advance CSS - Spring 2011.
 Website development process  CSS  Javascript.
CSS = Cascading Style Sheet CSS consists of rules to display, style and decorate HTML elements Why CSS ? – Separate decoration from HTML markup (Ex :,,…)
 Remember that HTML is just text  Need to point to pictures  Use the img tag  alt: › screen reader › REQUIRED for this class and to validate.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Tutorial 7.
Tutorial #6 – Creating Fixed Width Layouts. Tutorial #5 Review – Box Model Every html element is surround by a box Content, Padding, Border, Margin Can.
Week 8 – Part 2 Page Layout Basics Key Concepts 1.
Layout with Styles Castro Chapter 11. Tables vs. CSS You can produce “liquid layouts” (layouts that stretch as the browser is resized) using tables or.
Web Development & Design Foundations with HTML5 7th Edition
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
11/12/2015 Box Model Reed Crouch. 11/12/2015  HTML elements can be considered as boxes. In CSS, the term "box model" is used when referring to layout.
Today’s objectives Layouts | floats Measurement units Type properties
Web Development & Design Foundations with XHTML Chapter 6 Key Concepts.
Tutorial 4 Creating Page Layouts with CSS
Page Layout CHAPTER 5 1 CHARLES WYKE-SMITH: STYLIN’ WITH CSS: A DESIGNER’S GUIDE (3 ND EDITION)
5 th ed: Chapter 4 4 th ed: Chapter 5 SY306 Web and Databases for Cyber Operations SlideSet #5: Advanced CSS.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring 2016 CSS Positioning 1.
CIS67 Foundations for Creating Web Pages Professor Al Fichera Rev. September 22, 2010—All HTML code brought to XHTML standards. Reference for CIS127 and.
HTML and Dreamweaver November 11th. Agenda Box Model Displaying and positioning elements – Padding – Margin – Float – Display – Position HTML Demo.
CS 120: Introduction to Web Programming Lecture 10: Extra Features and Website Design Part 1 Tarik Booker CS 120 California State University, Los Angeles.
NAVIGATION USING HTML TO SET UP THE BASIC STRUCTURE OF A NAV BAR.
Laying out Elements with CSS
Cascading Style Sheets Layout
The Box Model in CSS Web Design – Sec 4-8
Cascading Style Sheets Boxes
Organizing Content with Lists and Tables
The Box Model in CSS Web Design – Sec 4-8
CSS Layouts: Grouping Elements
Webpage layout using CSS
Floating & Positioning
Advanced CSS BIS1523 – Lecture 20.
The Box Model in CSS Web Design – Sec 4-8
Web Development & Design Foundations with HTML5 7th Edition
Web Development & Design Foundations with HTML5 8th Edition
6 Layout.
Creating Layouts Using CSS
Fixed Positioning.
Controlling Layout with Style Sheets
MORE Cascading Style Sheets (The Positioning Model)
More CSS Page layout Boriana Koleva Room: C54
Floating and Positioning
Laying out Elements with CSS
CGS 3066: Web Programming and Design Fall 2019 CSS Part 2
Presentation transcript:

CONTROLLING Page layout Lesson 8 – Unit H CONTROLLING Page layout

The Box Model Box model: used by CSS to represent characteristics of every Web page element Treats element as rectangular box Border: border surrounding element Margin: space from border to neighboring/parent element Padding: space between border and element content

Box Model Layout

Box Model – Sizing it up Size of padding, margin, and border increase the amount of space occupied by an element. Dimensions of these properties not included in specified width / height. Specified width and height refer only to the content of an element.

What is the size of this example? 30 top margin 30 top border 30 top padding 80 content width 30 bottom padding 30 bottom border 30 bottom margin Add them all up and you get: 260

Box Model – Sizing it up When fitting elements into limited space, subtract padding, margin, and border area to get width or height. Separate property for each side of padding and margin e.g., padding-top:7px; margin-right:2em; Can set a common value using generic property e.g., padding:5;

Box Model – Collapse When bottom margin of one element is adjacent to top margin of another, the margins are combine to the size of the larger of the two. Element 1 margin 10 Element 2 margin 5 Result margin 10 (border to border) Element 1 { Element 2

Box Model – Specify Values Can use shorthand to set different values. e.g., margin: 1em 2em 1em 3em Values applied clockwise, first value for top If less than four values provided: Three values: top, left and right, bottom Two values: top and bottom, left and right

Box Model – Example <head> <style> h1 { border:15px solid blue; margin:20px; padding:20px; width:200px; } </style> </head> <body> <h1>CIS133</h1>

A few more items on the box model and css shorthand A few more items on the box model and css shorthand. HTML5 Semantic Elements

Multicolumn Layout with Float Since html code is rendered from the top down it is easy to create layouts with elements stacked vertically. Use float, clear, and width properties to create columns of text and graphic parallel to each other. Use width property to assign width to each of the columns.

Float An element can be pushed to the left or right, allowing other elements to wrap around it. Float is very often used for images, but it is also useful when working with layouts. Elements are floated horizontally, this means that an element can only be floated left or right, not up or down. A floated element will move as far to the left or right as it can. Usually this means all the way to the left or right of the containing element. The elements after the floating element will flow around it. The elements before the floating element will not be affected. If an image is floated to the right, a following text flows around it, to the left: img { float: right; }

Float and Clear If you place several floating elements after each other, they will float next to each other if there is room. Here we have made an image gallery using the float property:  .thumbnail { float:left; width:110px; height:90px; margin:5px; } Elements after the floating element will flow around it. To avoid this, use the clear property. The clear property specifies which sides of an element other floating elements are not allowed. Add a text line into the image gallery, using the clear property: .text_line { clear: both; }

article, body, dd, div, dl, dt, figcaption, figure, footer, h1, h2, h3, li, nav, ol, p, section, table, th, td, ul { margin: 0; padding: 0; } : #content { display: block; float: right; width: 32em; } #content p { margin: 0.5em 0; } #mainnav { text-align: left; padding: 0.25em; padding-left: 0.5em; float: left; width: 7em; position: absolute; left: 15px; } #mainnav a { text-decoration: none; } #mainnav li { list-style-type: none; padding: 0.25em 1em; margin: 0.25em 0; background: #B8944D;

Relative Positioning Page flow: the order of elements in the HTML document Relative positioning: adjusting default position of an element Preserves space allotted to element in default page flow Set position property to “relative” Style exact location using left and top properties

Relative Positioning (continued) X

Absolute Positioning Absolute positioning: takes element out of page flow entirely Allows other elements to flow into space element would have occupied Set position property to “absolute” Style exact location using left, right, top, and bottom properties Location is calculated relative to closest ancestor element that has position applied to it

Absolute Positioning (continued)

CSS Absolute and Relative Positioning Tutorial

Stacking Elements Stacking elements: positioning two elements so that they can overlap on a Web page Additional possibilities for layouts Applies only to positioned element Elements placed in new layer Requires careful planning Stacking order controlled by values assigned to z-index property

Stacking Positioned Elements

Z-Index CSS Tutorial 

Multicolumn Layout Using Positioning Can use positioning to create multicolumn layouts Look and behave just like float multicolumn layouts More flexible for 3-column, allows for 4-column layouts Can position both columns, or position one and let the other flow around it Leave large enough margin for positioned element

Comparing multicolumn layout methods

Fluid Layout Fixed layout: specifying a fixed width for Web page content Ensure consistency of visual design on different window sizes and resolutions Fluid layout: gives Web page flexibility to adjust its width while maintaining intended layout A.k.a. Liquid layout Uses min-width and max-width properties

Web page at different widths

Controlling the Visibility of Elements You can use CSS to style whether element is displayed Set visibility property to “hidden” Element content not visible Space reserved for invisible element Set display property to “none” Other elements reflow into space that would have been occupied by invisible element

Alternatives for hiding Web page elements

HTML5 Structure Elements <header>: Used to contain the header content of a site. <footer>: Contains the footer content of a site. <nav>: Contains the navigation menu, or other navigation functionality for the page. <article>: Contains a standalone piece of content that would make sense if syndicated as an RSS item, for example a news item. <section>: Used to either group different articles into different purposes or subjects, or to define the different sections of a single article. <aside>: Defines a block of content that is related to the main content around it, but not central to the flow of it.