Cascading Style Sheets Positioning Controls Visibility.

Slides:



Advertisements
Similar presentations
LIS650 lecture 4 Thomas Krichel today CSS Properties –Box properties-- List properties –Table properties-- Classification properties –(Audio.
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.
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.
Floating Elements CS380.
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.
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.
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
Tutorial 4 Creating Special Effects with CSS
MORE Cascading Style Sheets (The Positioning Model)
Working with Cascading Style Sheets. 2 Objectives Introducing Cascading Style Sheets Using Inline Styles Using Embedded Styles Using an External Style.
CSS to Know And this is just the beginning. What to What?  Tags = regular HTML  Ids = #id, only one hashtag per page  Class =.class, many as you want.
Svetlin Nakov Telerik Web Design Course html5course.telerik.com Manager Technical Training
Web Development & Design Foundations with XHTML Chapter 6 Key Concepts.
Advanced CSS - Page Layout. Advanced CSS  Compound Selectors:  Is a Dreamweaver term, not a CSS term.  Describes more advanced types of selectors such.
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.
Tutorial 4 Creating Special Effects with CSS. XP Objectives Work with CSS selectors Create styles for lists Create and apply class styles Create a rollover.
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.
Tutorial 4 Creating Special Effects with CSS
CSS Positioning Creating Special Effects with CSS CS202 Working with Cascading Style Sheets (Chapter 4) CS202 1.
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.
Web sites Design: Cascading Style Sheet (CSS) (Cont’d) Dimensions and Position of Elements –Width and Height Space –Table Cell Padding –Left and Top Position.
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.
Cascading Style Sheets Positioning Controls Visibility.
Internet Technology Dr Jing LU Updated Dr Violet Snell / Dr Kalin Penev 1 Internet Technology (week 6)  Recap: Validating HTML  Page Layout.
INTRODUCTORY Tutorial 5 Using CSS for Layout and Printing.
Positioning and Printing Creating Special Effects with CSS.
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.
Tutorial 4 Creating Special Effects with CSS. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Work with CSS selectors.
Tutorial 4 Creating Special Effects with CSS. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Work with CSS selectors.
Tutorial 4 Creating Special Effects with CSS. XP Objectives Work with CSS selectors Create styles for lists Create and apply class styles Create a rollover.
Cascading Style Sheets Class 3, Lecture 4 Rachel A Ober
MTA EXAM HTML5 Application Development Fundamentals.
CONTROLLING Page layout
Tutorial 4 Creating Page Layouts with CSS
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.
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.
Cascading Styles Sheets Positioning HTML elements.
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.
Cascading Style Sheets for layout
Laying out Elements with CSS
Cascading Style Sheets Layout
Cascading Style Sheets
Floating & Positioning
Cascading Style Sheets for layout
Putting Things Where We Want Them
Objectives Create a reset style sheet Explore page layout designs
Cascading Style Sheets
Styles and the Box Model
Positioning.
MORE Cascading Style Sheets (The Positioning Model)
Cascading Style Sheets
Tutorial 4 Creating Special Effects with CSS
Positioning.
Positioning.
Laying out Elements with CSS
Cascading Style Sheets™ (CSS)
Positioning Boxes Using CSS
Presentation transcript:

Cascading Style Sheets Positioning Controls Visibility

Positioning in the Window The browser window has 2 specific areas— the window and the active browser window. The active browser window (viewport) refers to the area where the HTML document is rendered.

The default for the first object in the window is (0,0) (top, left).: This is in contrast to standard X,Y plotting coordinates which have (0,0) in the bottom left corner

Position Types position: static –Defined based on the position of the element in the body of the document. position: relative –Defined based on its parent object; if not specified, it's the body position: absolute –Defined based on a rectangle starting from the top-left corner. Of the parent element. Objects are "out of the flow" of the normal document, so typically use a position:r elative wrapper position: fixed –Supported in IE7+ (and MOSe of course). This is one way you can make a header or sidebar not scroll

Defining an Object Position To position an element, you define the type of position, and usually the top-left corner of the object in the window Example –{ position: absolute; top : 3em; left : 5em;} –An object using this style definition would be positioned in the top of the parent/window 3ems down and 5ems from the left margin.

Defining position: Options for top and left –A value em or px a percentage –relative to the parent’s width auto (based on the browser calculation and the absolute position) Right and Bottom are also options but are not supported by all browsers. Also defining both left: and right: can cause conflicts

Stacking objects 3-D positioning You can use a position style called the z-index to give the sense of a 3 rd dimension (or stacking of the objects) in relationship to one another. Objects which are stacked are given z-index starting with 0. E.g..: z- index: 10; (Hint: use values such as 1, 10, 100 to be sure order is enforced) In order to cause the stacking to happen, you use the position, top, left and z-index to define the object position. Elements w/o position: won't stack. You can change the appearance by redefining the width and height. If you don’t set the z-index, the elements stack in the opposite order and the large one is set on top

You may use the position styles to lay a series of the same object on top of itself. Set the first object as absolute with a top and left and a z-index of 0. Set the second object as absolute with a higher top and a further left value and a z-index of 1. Set the third object as absolute with a higher top and a further higher left value and a z-index of 2.

Example.pos1 {position:absolute; z-index: 0}.pos2 {position:absolute; top: 2em; left: 3em; z- index: 1;}.pos3 {position:absolute; top:5em; left;7em; z- index: 2;}

Floats float: –Options are :left; :right; Note therefore you cannot float: top; and so on. Should specify width for floated elements Combine with clear: (left; right; both;) to move next element below floated elements, e.g. for footers #footer {clear: both;} Some (e.g. Zeldman) stick to floats even though position: has more semantic meaning

Absolute within a Relative If you position an object using an absolute position within a relative element, the absolute object will appear in an absolute place within the relative box. Often used for wrapper then #wrapper {position: relative; width: 90% margin: 0 auto;} May be used to put a background image in a paragraph.

Relative within an Absolute The absolute object is positioned—the relative object is positioned within the limits of the absolute window (see "dropshadow" example) If you move the absolute object— everything moves.

Visibility You may set the visibility of an object to be hidden {visibility: hidden;}. This will cause the space for the object to be allocated in the page and a big rectangle placed where the object should be in the page. With a visibility setting the object is allotted space in the page—with display set to none, no space is set in the page. {display: none;}

Clipping an Object You can cause the portions of an object to be clipped Style – clip: rect(top,right,bottom,left) –The values are distances from the element’s origin.

Overflowing an Object Defines how an object is displayed when it doesn’t fit in area (e.g. when clipped). overflow: –scroll Sets the scroll bars around the visible area (acts like an ) –hidden Hides the overflow area and the scroll bars –visible Causes the clipped area to shop up over the area. –auto Allows the browser to define how to handle this overflow.

Opacity Use of filter: for old IE opacity: for MOSE. Also we'll look at rgba(), part of CSS3 cursor: (lots of options, e.g. cursor: help; for popup boxes) Scrollbars (old IE only)