MORE Cascading Style Sheets (The Positioning Model)

Slides:



Advertisements
Similar presentations
15 LAYOUT Controlling the position of elements Creating site layouts Designing for different sized screens.
Advertisements

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.
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.
CIS 1310 – HTML & CSS 6 Layout. CIS 1310 – HTML & CSS Learning Outcomes  Describe & Apply the CSS Box Model  Configure Float with CSS  Designate Positioning.
9-May-15 More CSS. 2 A different emphasis CSS is the same for XML as it is for HTML and XHTML, but-- XML contains no display information If you want your.
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 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.
14-Jul-15 CSS Applications to XML. 2 A different emphasis CSS is the same for XML as it is for HTML, but-- HTML already does a pretty good job of layout.
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.
1 The Structure of a Web Table beginning of the table structure first row of three in the table end of the table structure table cells You do not need.
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.
Web Development & Design Foundations with XHTML Chapter 6 Key Concepts.
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
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.
New Perspectives on XML, 2nd Edition Tutorial 5 1 TUTORIAL 5 WORKING WITH CASCADING STYLE SHEETS.
XP New Perspectives on XML Tutorial 5 1 TUTORIAL 5 CSS Tutorial – Carey ISBN
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.
1 Cascading Style Sheets (CSS) Part 2. 2 The Sources of Style Sheets.
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.
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 WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Svetlin Nakov Telerik Corporation
Web Foundations THURSDAY, OCTOBER 3, 2013 LECTURE 6: CSS CONTINUED.
 Cascading Style Sheets (CSS) ◦ Used to specify the presentation of elements separately from the structure of the document.  Inline style ◦ declare.
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.
1 CS428 Web Engineering Lecture 08 Border, Margin, Padding … (CSS - III)
INTRODUCTORY Tutorial 5 Using CSS for Layout and Printing.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  CSS Box Model  CSS properties for border  CSS properties for.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  float & clear  display & visibility.
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.
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.
Web Foundations MONDAY, OCTOBER 7, 2013 LECTURE 7: CSS LINK COLORS, INTERMEDIATE CSS.
Cascading Style Sheets (CSS) Part II IT210: Web-based IT.
Extra-simplified.  Only truly happen when the CSS and HTML are defined as separate files (external style sheet) Introduction The main idea of CSS is.
Tutorial 4 Creating Page Layouts with CSS
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.
Understanding CSS Cascading Style Sheets control the presentation of content in HTML pages Style Sheets separate formatting from the content –Styles defined.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
Cascading Styles Sheets Positioning HTML elements.
Laying out Elements with CSS
Cascading Style Sheets Layout
Cascading Style Sheets Boxes
CSS Layouts: Grouping Elements
Webpage layout using CSS
Floating & Positioning
The Internet 10/25/11 XHTML Tables
Styles and the Box Model
Controlling Layout with Style Sheets
CSS Borders and Margins.
Second CSS Lecture Applications to XML
Positioning.
MORE Cascading Style Sheets (The Positioning Model)
Floating and Positioning
Positioning.
CSc 337 Lecture 5: Grid layout.
Positioning Boxes Using CSS
Presentation transcript:

MORE Cascading Style Sheets (The Positioning Model)

Slide 2 CSS (Box Model) Remember that CSS views all HTML 5 elements as a rectangular box consisting of A margin around the box A border Padding, which is the boundary from the content to the border of the box The box’s content

Slide 3 CSS Box Model (Description) margin – Whitespace (transparent) surrounding the border border - A border inside the margin. The border is affected by the background color of the box padding – Whitespace inside the border and outside the content Padding is affected by the background color of the box content - The content of the box, where text and images appear

Slide 4 Box Size The box size is controlled by two properties width Use relative measures to size around the parent window or browser window Absolute values work too height Contents will overflow the box if the height is set See BoxIntro.htm

Slide 5 CSS Box Model (Margin) Margin appears outside of the border Margins have no color They are always transparent Use margins to create padding next to adjacent elements

Slide 6 CSS Box Model (Margin – Example) Set all box margins margin: 10px; Set the individual box margins margin-top:100px; margin-bottom:100px; margin-right:50px; margin-left:50px;

Slide 7 Outline The outline property works like the border property It appears outside of the border for emphasis It has a style, color, and width See BoxIntro.htm

Slide 8 Padding The space inside the border and surrounding the box content Set all at once or the individual sides padding-top padding-bottom padding-left padding-right

Slide 9 Positioning Elements (Introduction) So far, we have applied styles to format text or to format various box margins Here, we are talking about how to explicitly position the box itself relative to other boxes This discussion involves the concept of flow Pay particular attention to the use of the and tags

Slide 10 Flow (Introduction 1) There are two types of flow (positioning) Block Elements start on a new line By default, they are the same width as their container, Inline An element starts on the same line as the preceding element,,, etc..

Slide 11 Flow (Introduction 2) It’s possible to control flow using the CSS position property static fixed relative absolute float

Slide 12 Positioning (Static) Static Positioning (normal flow) This is the default positioning method Items are positioned according to the normal page flow Left to right – top to bottom The top, bottom, left, and right properties are not applied when static positioning is applied

Slide 13 Positioning (Fixed 1) Fixed Positioning An element is positioned relative to the browser window or parent container Elements will not move even if the browser contents are scrolled Fixed elements are no longer part of the normal document flow

Slide 14 Positioning (Fixed 2) Use properties ( top, bottom, left, right ) to specify the coordinate Elements can overlap Use the z-index property to control overlap Larger values appear in front – smaller values appear in back See FixedPositioning.htm

Slide 15 Positioning (Relative 1) Relative Positioning Elements are positioned “relative” to the normal position Normal document flow is still used Use properties ( top, bottom, left, right ) to specify the coordinate relative to the normal flow Negative values move left Positive values move right

Slide 16 Positioning (Relative 2) A relative positioned element is positioned relative to its normal position Use left, right, top, left to alter the position Note that negative values are possible left:-20px will move the box 20 pixels to the left Relative positioning is typically used for containers such as

Slide 17 Positioning (Relative 3) Elements might overlap Use the z-index property to specify which overlapping item is in front, and which is in back The property has an integral value Larger values appear in front of smaller values See RelativePositioning.htm

Slide 18 Positioning (Absolute) Element is positioned relative to The first parent element that has a position other than static Remember that static is the default Or the browser window Absolute positioned elements are removed from the normal document flow Absolute positioning is often used with containers See AbsolutePositioning.htm

Slide 19 Floating Content We often want text to wrap around an image or other element This is the purpose of the float property Elements are always floated horizontally If an element is floated left, elements float from the left side of the browser window or container The reverse is true when elements are floated from the right See Floating.htm

Slide 20 Controlling Display (1) The display property describes how elements will be displayed block – elements are displayed as a block with whitespace above and below inline – elements are displayed inside the current block on the same line none – elements are not displayed and take up no space