CSS Positioning & Layout Creating layouts and controlling elements.

Slides:



Advertisements
Similar presentations
LIS650 lecture 4 Thomas Krichel today CSS Properties –Box properties-- List properties –Table properties-- Classification properties –(Audio.
Advertisements

Copenhagen, 6 December 2004 Modern CSS Principles Miruna Bădescu Finsiel Romania.
Week 10 Creating Positioned Layouts
15 LAYOUT Controlling the position of elements Creating site layouts Designing for different sized screens.
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
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.
With CSS, a color is most often specified by: a HEX value - like "#ff0000" an RGB value - like "rgb(255,0,0)" a color name - like "red“ Example h1.
Floating Elements CS380.
Tutorial 4: Creating page layout with css
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.
Tutorial 6 Creating Fixed-Width Layouts
TUTORIAL 4: CREATING PAGE LAYOUT WITH CSS Session 4.3.
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.
CSS, cont. October 12, Unit 4. Creating a Sidebar We know how to create a sidebar –Use the float property div#sidebar{ float: left; } Item1 Item2 Item3.
An Introduction to Cascading Style Sheets CSS Layout, and the CSS Box Model Nick Foxall SM5312 week 9: CSS Layout.
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
MORE Cascading Style Sheets (The Positioning Model)
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.
Svetlin Nakov Telerik Web Design Course html5course.telerik.com Manager Technical Training
Web Development & Design Foundations with XHTML Chapter 6 Key Concepts.
Cascading Style Sheet Basics Pepper. Looking at the HTML See the surrounding tags See head, body, paragraph, header See the ending tags See the list.
Tutorial 4: Using CSS for Page Layout. 2 Objectives Session 4.1 Explore CSS layout Compare types of floating layouts Examine code for CSS layouts View.
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 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.
Neal Stublen Course Road Map  Create web page layouts using CSS  Manage CSS  Test website validity  Create navigation menus using.
Page Layout with CSS Learning Web Design: Chapter 16.
Web Programming Language CSS – Part 2 Dr. Ken Cosh (CSS II)
CSS Float Property Keyword: Flow. CSS Float: Positioning Property Purpose: Push a block-level element to the left or right, taking it out of the flow.
Floating Elements CS The CSS float property (reference) 2 img.headericon { float: right; width: 130px; } CSS  removed from normal document flow;
THE BOX MODEL Putting layouts together with CSS. The Box Model  How would you describe a box?  Container?  Tags or elements are “containers”  puts.
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.
Internet Technology Dr Jing LU Updated Dr Violet Snell / Dr Kalin Penev 1 Internet Technology (week 6)  Recap: Validating HTML  Page Layout.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  float & clear  display & visibility.
Cascading Style Sheets (CSS) Part II IT210: Web-based IT.
CONTROLLING Page layout
IN THE DOCUMENT OBJECT MODEL, EACH LINE OF HTML IS AN ELEMENT (AN OBJECT), ABLE TO HAVE ATTRIBUTES, PROPERTIES AND VALUES. CSS TELLS THE BROWSER HOW TO.
- WE’LL LOOK AT THE POSITION PROPERTY AND HOW CSS RESOLVES CONFLICTS BETWEEN STYLING INSTRUCTIONS The position property; CSS specificity hierarchy.
Today’s objectives  Announcements  Positioning  Measurement units.
Week 5.  Normal document flow  Affecting document flow with float and position properties using CSS  Using these properties to create layouts.
Understanding CSS Cascading Style Sheets control the presentation of content in HTML pages Style Sheets separate formatting from the content –Styles defined.
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.
CHAPTER 15 Floating and Positioning. FLOAT VS. POSITION  Floating an element moves it to the left or right, allowing the following text to wrap around.
CSCI N241: Fundamentals of Web Design Copyright ©2006  Department of Computer & Information Science Using CSS for Absolute Layouts.
Laying out Elements with CSS
Cascading Style Sheets Layout
CSS Layouts: Positioning and Navbars
Webpage layout using CSS
Floating & Positioning
Cascading Style Sheets for layout
Putting Things Where We Want Them
The Internet 10/25/11 XHTML Tables
Creating Layouts Using CSS
Styles and the Box Model
Controlling Layout with Style Sheets
Positioning.
MORE Cascading Style Sheets (The Positioning Model)
Web Programming Language
HTML – Organizing Page Content
HTML – Organizing Page Content
More CSS Page layout Boriana Koleva Room: C54
Floating and Positioning
Web Programming Language
Positioning.
Laying out Elements with CSS
CSc 337 Lecture 5: Grid layout.
Positioning Boxes Using CSS
Presentation transcript:

CSS Positioning & Layout Creating layouts and controlling elements

About CSS Layout There are two methods for arranging items on the page using CSS, Floating and Positioning.  Floating an element moves it to the left or right with text wrapping around the element.  Positioning specifies the location of any element anywhere on the page with pixel precision.

Float The float property moves an element to the left or right allowing any proceeding content to wrap around the element. Floats can be used to create multicolumn layouts, navigation and table like alignment. The values for float are left, right, none and inherit, with none being the default. * Float None * Float Left * Float Right * Floating Text * Clearing Floating Elements

Positioning There are two main types of positioning: absolute and relative and a third that is slightly different called fixed. The basic CSS structure for all is: tag {position: choice; top: 0px; bottom: 0px; left: 0px; right: 0px; }

Relative All elements have a natural flow (very Zen) basically where you place it in the code, that is where it generally goes. Most elements will position themselves naturally top to bottom and left to right. When we position something relatively, the surrounding elements are not affected; rather we position the element relative to where it would have naturally appeared. img {position: relative; top: 50px; left: 100px; } The CSS could be applied to the item, but when creating CSS for layout, it is a good idea to apply to a class or ID. So actually, I would write my CSS like this:. photo {position: relative; top: 50px; left: 100px; }

Absolute When you position something absolutely it will appear at the exact pixel you specify. Let’s say I want to position an image at 50 pixels from the top and 100 pixels from the left. I would write the CSS like this: img {position: absolute; top: 50px; left: 100px; } The CSS could be applied to the item, but when creating CSS for layout, it is a good idea to apply to a class or ID. So actually, I would write my CSS like this:. photo {position: absolute; top: 50px; left: 100px; } Elements positioned with Absolute can overlap other elements (not always a bad thing). Also, if you want the layout to be flexible, you might want to use ems and percentages when you position.

Fixed When you position something fixed it will stay stationery regardless of what the user does with the browser. So even if a user scrolls, the image will stay still. Fixed may not work with older browsers. I would write the CSS like this: img {position: fixed; top: 50px; left: 100px; } The CSS could be applied to the item, but when creating CSS for layout, it is a good idea to apply to a class or ID. So actually, I would write my CSS like this:. photo {position: fixed; top: 50px; left: 100px; }

Resources  Float Tutorial  W3C Schools Positioning

Leverage  Nice and Free CSS Layout Templates  Layout Gala  Little Boxes