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.

Slides:



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

LIS650 lecture 4 Thomas Krichel today Advice CSS Properties –Box properties –List properties –Classification properties Fun with selectors.
Copenhagen, 6 December 2004 Modern CSS Principles Miruna Bădescu Finsiel Romania.
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.
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.
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.
Floating Elements CS380.
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.
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.
An Introduction to Cascading Style Sheets CSS Layout, and the CSS Box Model Nick Foxall SM5312 week 9: CSS Layout.
MORE Cascading Style Sheets (The Positioning Model)
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.
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
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.
Principles of Web Design 6 th Edition Chapter 7 – Page Layouts.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
The Missing Manual MARGINS, PADDING, & BORDERS—CHAPTER 7.
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.
Today’s objectives  Assignment 1  Padding, Margins, Borders  Fluid Layout page  Building accessible Table  Element size with padding and border 
Tutorial #6 – Creating Fixed Width Layouts. Tutorial #5 Review – Box Model Every html element is surround by a box Content, Padding, Border, Margin Can.
Floating Elements CS The CSS float property (reference) 2 img.headericon { float: right; width: 130px; } CSS  removed from normal document flow;
Week 8 – Part 2 Page Layout Basics Key Concepts 1.
THE BOX MODEL Putting layouts together with CSS. The Box Model  How would you describe a box?  Container?  Tags or elements are “containers”  puts.
Web Development & Design Foundations with HTML5 7th Edition
CSS Fun damentals The Document Hierarchy Element Relationships The Box Model.
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.
Cascading Style Sheets (CSS) Part II IT210: Web-based IT.
CSS Positioning & Layout Creating layouts and controlling elements.
CONTROLLING Page layout
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring 2016 CSS Positioning 1.
HTML and Dreamweaver November 11th. Agenda Box Model Displaying and positioning elements – Padding – Margin – Float – Display – Position HTML Demo.
Nesting and Floating. Nesting and Floating Elements To make our page content appear the way we want, and to make the best use of screen space, we can.
Ch 11 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.
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.
NAVIGATION USING HTML TO SET UP THE BASIC STRUCTURE OF A NAV BAR.
Cascading Style Sheets for layout
Laying out Elements with CSS
Floating & Positioning
Advanced CSS BIS1523 – Lecture 20.
Cascading Style Sheets for layout
Cascading Style Sheets (Layout)
Web Development & Design Foundations with HTML5 7th Edition
Web Development & Design Foundations with HTML5 8th Edition
Web Development & Design Foundations with HTML5
The Internet 10/25/11 XHTML Tables
CSS Applications to XML 19-Sep-18.
Objectives Create a reset style sheet Explore page layout designs
Controlling Layout with Style Sheets
Second CSS Lecture Applications to XML
MORE Cascading Style Sheets (The Positioning Model)
Web Development & Design Foundations with H T M L 5
Web Development & Design Foundations with HTML5
More CSS 22-Feb-19.
Floating and Positioning
Web Development & Design Foundations with HTML5
Laying out Elements with CSS
CSS Applications to XML 20-May-19.
CSc 337 Lecture 5: Grid layout.
CSS Applications to XML 3-Jul-19.
Positioning Boxes Using CSS
CGS 3066: Web Programming and Design Fall 2019 CSS Part 2
Presentation transcript:

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

CSS and Boxes The underlying model of CSS relies on the notion of boxes –Your screen is a rectangular box –A paragraph fits into a box –An image, etc. Boxes have a number of properties (we’ve used them) –Margin –Border –Padding

Boxes, cont. Content: the main content of the box Padding: space between content and border Border: the border around the content (taking into account padding) Margin: the space between this box and adjacent boxes Image from:

Margins are Special Margins will actually change size depending on what’s adjacent to the box If two boxes with margins are horizontally adjacent (side by side), the margin for each box stays the same –Two boxes both with left and right margins of 15px, the total space between the boxes would be 30px But, when you have one box on top of another, the margins are collapsed –The space between the boxes becomes the larger of the two margins –If the top box had a margin of 25px and the bottom box a margin of 10px, the space between the boxes would be 25px

How Floats Change Pages Normally when we write html, our block- level elements stack up to create the vertical space on our page Block-level elements are not placed side- by-side But we can break this using the float property –We remove the block from the normal flow of the page and allow content to wrap around it.

Issues with Float Float seems pretty simple to use But, let’s say you have two nested tags, the inner one has the float: left applied to it …… …….

Floated Objects Outside of “Parent” Boxes When elements are floated, you can think of them as being pulled out of the standard html flow Because of this, that sidebar we created earlier may extend beyond the borders of parent wholepage But the purpose of having a wholepage identifier was to specify something for the entire page

Issues with Float When floating elements, it’s not always a sidebar –We could be floating something like an image Remember from the 2 column example that the second column appeared next to the sidebar What would have happened if we wanted to place an element below the floated element?

Clear Property To save us from these float issues, we can use the clear property Specifies that you want to move below the floated content clear can take the value of : none, left, right, and both clear: none –This element can appear next to any floated element

Clear cont. clear: left –Clear all elements to the left –This element cannot appear to the right of any floated content –This element can still appear on the left side of floated content clear: right –Clear all elements to the right –This element cannot appear to the left of any floated content –This element can still appear on the right side of floated content

Clear: both clear:both –Clears elements on both the left and right side –This element cannot appear to the left or the right of any floated content –Means that this element has to appear below the floated content We can use this to place elements below all floated content We can also use this to help make parent tags contain (think borders) all of their floating content

In class Example 3 column layout Adding a footer

Using Display Property The display property can have the following 4 values: –none –block –inline –list-item What’s it do? –Tells the browser how to display the element its applied to

display:inline display:inline is a fairly useful property It allows a developer to tell the browser to display a block-level tag inline Instead of taking up vertical space, the item now takes up horizontal space We can make horizontal list items

In Class Example of display:inline

display, cont. display:block displays an element as a block-level element –Takes up vertical space on the screen display:list-item displays an element as a list item –Block-level element plus a list-item marker display:none tells the browser not to display the item The display property can be quite useful for some applications –But, it causes items to be displayed in a manner they weren’t intended –There’s a good reason lists look like they do –Why paragraphs take up vertical space Do not change the display property of an element when simply using another element would achieve the same results

Pictures We can float columns of content What about making pages using pictures We simply use the same principles as we did for columns and content within the columns We can create not only single floating images, but image galleries (thumbnails arranged nicely)

In Class Example with Pictures