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.

Slides:



Advertisements
Similar presentations
LIS650 lecture 4 Thomas Krichel today Advice CSS Properties –Box properties –List properties –Classification properties Fun with selectors.
Advertisements

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.
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.
CIS 1310 – HTML & CSS 6 Layout. CIS 1310 – HTML & CSS Learning Outcomes  Describe & Apply the CSS Box Model  Configure Float with CSS  Designate Positioning.
Class four: the box model and positioning. is an HTML tag which allows you to create an element out of inline text. It doesn’t mean anything! try it:
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.
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)
Svetlin Nakov Telerik Web Design Course html5course.telerik.com Manager Technical Training
Web Development & Design Foundations with XHTML Chapter 6 Key Concepts.
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.
+ Cascading Style Sheets Positioning for any XHTML container tag (selected by name, class or id)
CSS = Cascading Style Sheet CSS consists of rules to display, style and decorate HTML elements Why CSS ? – Separate decoration from HTML markup (Ex :,,…)
Svetlin Nakov Telerik Corporation
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.
INTRODUCTORY Tutorial 5 Using CSS for Layout and Printing.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  float & clear  display & visibility.
Web Foundations MONDAY, OCTOBER 7, 2013 LECTURE 7: CSS LINK COLORS, INTERMEDIATE CSS.
Cascading Style Sheets Positioning Controls Visibility.
CSS Positioning & Layout Creating layouts and controlling elements.
CONTROLLING Page layout
Tutorial 4 Creating Page Layouts with CSS
CSS - Quiz #3 Lecture Code:
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.
CIS67 Foundations for Creating Web Pages Professor Al Fichera Rev. September 22, 2010—All HTML code brought to XHTML standards. Reference for CIS127 and.
Advanced CSS. Display  Hiding an element can be done in two ways  display:none  Element is hidden and will no longer take up space on the page  Can.
- WE’LL LOOK AT THE POSITION PROPERTY AND HOW CSS RESOLVES CONFLICTS BETWEEN STYLING INSTRUCTIONS The position property; CSS specificity hierarchy.
HTML and Dreamweaver November 11th. Agenda Box Model Displaying and positioning elements – Padding – Margin – Float – Display – Position HTML Demo.
THE NORMAL DOCUMENT FLOW from Quick Tip: Utilizing Normal Document Flow by Alex Rodrigues on Web tuts.
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.
Mimi Opkins.  One of the major benefits of using CSS is that you’re not forced to lay your sites out in tables.  The layout possibilities of CSS give.
Laying out Elements with CSS
Cascading Style Sheets Layout
Cascading Style Sheets Boxes
CSS Layouts: Positioning and Navbars
Webpage layout using CSS
Cao Yuewen SEEM4570 Tutorial 03: CSS Cao Yuewen
Floating & Positioning
Advanced CSS BIS1523 – Lecture 20.
The Internet 10/25/11 XHTML Tables
PAGE LAYOUT - 2.  The div tag equipped with CSS rules produces good looking pages.  With CSS, the div tag can easily be positioned anywhere on the page.
Objectives Create a reset style sheet Explore page layout designs
Styles and the Box Model
Controlling Layout with Style Sheets
Positioning.
MORE Cascading Style Sheets (The Positioning Model)
HTML – Organizing Page Content
HTML – Organizing Page Content
Floating and Positioning
Positioning.
Positioning.
Laying out Elements with CSS
The div Element and CSS for layout
CSc 337 Lecture 5: Grid layout.
Positioning Boxes Using CSS
Presentation transcript:

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 full width of space available and have a line break before and after it. Examples: & & & & & Other HTML elements have a default display setting of Inline. Inline elements take up only the amount of space they need for their content and do not force any line breaks. Examples:

Remember the Box Remember when executing a layout in CSS that every HTML element can be thought of as a box and therefore they can all have padding, margin and border properties applied to them to alter the amount of space they occupy and how close they are to other objects.

Dimensions Dimensions of an element can be set using any of these properties: height width max-height max-width min-height min-width These are set using the auto, pixel, percentage or inherit values.

Positioning The Position Property allows you to position an element and specify what should happen when an elements content is too big. Elements can be positioned using the top, bottom, left and right properties. However, these properties will not work unless the position property is set first. They will work differently depending on the position method chosen. There are four different positioning methods.

Static Positioning HTML elements are positioned static by default. A static positioned element is always positioned according to the normal flow of the page. Static positioned elements are not affected by the top, bottom, left and right properties.

Fixed Positioning An element with fixed position is positioned relative to the browser window. It will not move even if the window is scrolled as they are removed from the normal flow. The rest of the document will behave like the Fixed Element does not exist.

Relative Positioning A relative positioned element is positioned relative to it’s normal position. The content of a Relative Element can be moved and overlap other elements, but the reserved space for the element is preserved in the normal page flow. These are often used as containers for absolutely positioned elements.

Absolute Positioning An absolute positioned element is positioned relative to the first parent element that has a position other than static. If no such element is found, the containing block is. Absolute Elements are removed from the normal flow and the document will behave like the Absolutely Positioned Element does not exist. Absolute Elements can also overlap other elements. When elements are positioned outside of the normal flow (Fixed and Absolute), they can overlap other elements. The z-index property specifies the stack order of an element (which element should be in front or behind others). An element can have a positive or negative order and elements with the greatest number will appear in front of elements with lower numbers. If two elements overlap and do not have a z-index specified, the element positioned last in the HTML code will be shown on top.

Float With the Float Property, an element can be pushed left or right, allowing other elements to wrap around it on the open side. Float is often used on images for word wrap, but it is also very helpful for layouts. Elements float horizontally only and the floated element will move as far right or left as it can (to the very edge of the containing element). Elements that follow it in the html code will flow around it and elements before it in the code will not be affected. You can turn float off when needed by setting the float property to float:none;. You can prevent elements below the floated element from wrapping around by using the Clear Property. Clear can be set to left, right or both. I often have a class selector called clear that I can reused when needed to prevent items from wrapping. It usually looks like this:.clear{clear:both;}. And I often use it on the page like such:.

Aligning Block Elements As I have mentioned, elements that have a default display setting of block will by default occupy the entirety of the available width. However, if you set a block element’s width to something less than 100%, you will notice that it will often left align by default. If you’d like to center align the block element, you can utilize the Margin Property to make this happen. By setting the margin-left and margin-right properties to “auto”, you will center the block element within it’s parent container. Left and Right align the block element by using the Float Property. Float left or right will do the job, but you must have the element’s width set as smaller than 100% of the container element. I suggest setting the margin and padding properties to “0” in the body tag selector in your stylesheet as this will prevent crossbrowser compatibility issues.