+ Cascading Style Sheets Positioning for any XHTML container tag (selected by name, class or id)

Slides:



Advertisements
Similar presentations
LIS650 lecture 4 Thomas Krichel today Advice CSS Properties –Box properties –List properties –Classification properties Fun with selectors.
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.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Today CSS HTML A project.
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.
Cascading Style Sheets. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. CSS is a.
Cascading Style Sheets By: Valerie Kuna. What are Cascading Style Sheets? Cascading Style Sheets (CSS) are a standard for specifying the presentation.
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.
Cascading Style Sheets Color and Background Controls Border and Margin Controls (Boxes)
Text Properties, Line Box, CSS. Text Properties Properties related to the display of text. Text-align : left, right, center I like FSU!
MORE Cascading Style Sheets (The Positioning Model)
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.
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.
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.
Cascading style sheets (CSS)
ITP 104.  While you can do things like this:  Better to use styles instead:
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
CSS Positioning Creating Special Effects with CSS CS202 Working with Cascading Style Sheets (Chapter 4) CS202 1.
Web Development & Design Foundations with XHTML
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.
MCS 270 Cascading Style Sheets (CSS) Gustavus Adolphus College.
CSS: Cascading Style Sheets. 2 What are Style Sheets A style sheet is a mechanism that allows to specify how HTML (/XHTML/XML) pages should look The style.
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.
 Website development process  CSS  Javascript.
MySQL and PHP Review CSS. Cascading Style Sheet (CSS) Style sheets are files or forms that describe the layout and appearance of a document. Cascading.
CSS = Cascading Style Sheet CSS consists of rules to display, style and decorate HTML elements Why CSS ? – Separate decoration from HTML markup (Ex :,,…)
Cascading Style Sheets Chapters 5-6 Color and Background Controls Border and Margin Controls.
Svetlin Nakov Telerik Corporation
>> The “Box” Model. Pre-requisite Create a new project in Netbeans called Week5 Create a new html file and name it box.html Create a new css file and.
Week 8 – Part 2 Page Layout Basics Key Concepts 1.
Cascading Style Sheets Positioning Controls Visibility.
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.
Copyright © Osmosys O S M O S Y SO S M O S Y S D e p l o y i n g E x p e r i e n c e & E x p e r t i s e™ CSS Training.
Cascading Style Sheets Positioning Controls Visibility.
Cascading Style Sheets (CSS) Part II IT210: Web-based IT.
Web Development & Design Foundations with XHTML Chapter 6 Key Concepts.
MTA EXAM HTML5 Application Development Fundamentals.
CSS - Quiz #3 Lecture Code:
CSS: Cascading Style Sheets Part II. Style Syntax.
CSS FOUNDATIONS IN-DEPTH The nitty-gritty of css...
Understanding CSS Cascading Style Sheets control the presentation of content in HTML pages Style Sheets separate formatting from the content –Styles defined.
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.
Cascading Style Sheets Layout
Cascading Style Sheets Boxes
CSS Layouts: Grouping Elements
Webpage layout using CSS
>> The “Box” Model
Floating & Positioning
Web Systems & Technologies
The Internet 10/25/11 XHTML Tables
Cascading Style Sheets
MORE Cascading Style Sheets (The Positioning Model)
Cascading Style Sheets
Web Development & Design Foundations with H T M L 5
Floating and Positioning
The Internet 10/20/11 CSS Layout
CSc 337 Lecture 5: Grid layout.
Cascading Style Sheets™ (CSS)
Positioning Boxes Using CSS
Presentation transcript:

+ Cascading Style Sheets Positioning for any XHTML container tag (selected by name, class or id)

+ The Fundamental Objects Elements nested within elements = boxes within boxes Size and position of each element is determined by its enclosing box

+ Sizing: width & height auto [Number]px [Number]% p{width:auto;} Block element box occupies full width of parent box. p{width:50em;} Block element box 50 ems wide. em{width:auto;} Inline element box takes only what their contents need within the parent. em{width: 40px;} Inline element contents will ignore unless positioned, but background and some other box-related attributes won’t. p{height: 80%;} Percentages are relative to parent dimensions

+ What is Positioning? Controlling the location of elements (boxes) on the screen

+ Default Flow vs. Positioning Browser-controlled Flow Follow order in which the elements appear in the code, inserting line breaks before and after blocks Positioning Make specific instructions to the contrary Stone in the stream? Cookie cutter cut-out? Collage? will be rewarded. Clean- Up Copy (cp, not mv) your project1 directory files (including style sheet) into the www/imm/project2 directory.

+ Float

+ Relative

+ Absolute

+ Simplest: float Want the element to hug a side with everything else flowing around it?.pict {float:right;} float: right; // Aligns element to the right (other elements wrap around it’s left) left right

+ Simplest: float Want the element to hug a side with everything else flowing around it?.pict {float:right; clear:right;} clear: right; // Don’t display element until right side is “clear” of other floaters left right both Without clear declaration

+ More Complex: position (with top, right, bottom, left) static: follow default flow within parent Inline just right of previous element Block just under previous element, width of parent relative: position relative to default location (0,0 = normal location) Does not change flow location for later elements absolute: position relative to parent location (0,0 = upper-left non-static parent corner) fixed: position relative to tag location (0,0 = upper-left window corner)

+ More Complex: position.parent { background:#cccc66; position: relative; float:right; width:400px; }.child {background: #66cccc; position: absolute; top: 50px; left: 20%; right: 30%; }

+ More Complex: position.parent { background:#66ccff; /* position: static; relative; */ float:right; width:400px; }.child { background: #6699cc; /* position: static; relative; absolute; fixed; */ top: 50px; //from top left: 20%; //from left right: 30%; //from right } s s s or r r s a r a r f No fixed right edge to be relative to

+ Did you see those overlaps? Several elements can stack on top of each other in space Elements appearing later in the code go on top

+ Positioning Effects: Overflow What happens to a child box within a parent box when the child box is too big?.parent {overflow:hidden;} // visible hidden scroll hidden scroll visible

+ Positioning Effects: Display & Visibility Control if a box displays as a block, inline or not at all a {display:block; width:200px;} // block inline list-item none Make box transparent (same flow)..ghost {visibility:hidden;} // visible hidden collapse

+ Positioning - typical layout Column A is here. Column B is here. Column A is here. Column B is here.

+ Positioning - typical layout.columnA {width: 45%;}.columnB {margin-left: 55%;} Column A is here. Column B is here.

+ Positioning - typical layout.columnA {width: 45%; float: left; }.columnB {margin-left: 55%;} Column A is here. Column B is here.

+ Positioning - getting crazy shadow front some stuff caption shadow some stuff front caption

+ Positioning - getting crazy.shadow {position: relative;}.front {position: absolute; top: -10px; left: -10px;} shadow some stuff front caption

+ Positioning - getting crazy.shadow {position: relative;}.front {position: absolute; top: -10px; left: -10px;}.caption {position: relative; top: -70px;} shadow some stuff front caption

+ Random Useful Stuff

+ CSS Pseudo Classes a.snowman:link { color: blue; } a.snowman:visited { color: purple; } a.snowman:active { color: red; } a.snowman:hover { text-decoration: none; color: blue; background-color: yellow; } Suggested order: link for an unvisited link. visited for a link that has already been visited. active for when a link gains focus (tabbed to or clicked on). hover for when the cursor is held over a link (not keyboard interactions).

+ CSS Properties I’ve known & loved white-space: normal | pre | nowrap display: block | compact | inline | list-item | none max-width: 50em; min-width: 100px; text-transform: capitalize; line-height 1.2; Also fun… letter-spacing and word-spacing When I want a truly clean slate for spacing around blocks, * { padding: 0; margin:0; border: 0;} If you want set-width content to be centered in container, margin: 0 auto; Also, having items belong to more than one class can be handy, split- personality disorder

+ & elements Eric Meyer wrote: What's so interesting to me is that the guys who decided to focus on the positive went out and did something; those who want to mix in the negative seem to have nothing to offer except complaints. An excellent contrast between those who want to build new things and those who want to tear them down.

+ & elements Eric Meyer wrote: What's so interesting to me is that the guys who decided to focus on the positive went out and did something; those who want to mix in the negative seem to have nothing to offer except complaints. An excellent contrast between those who want to build new things and those who want to tear them down.

+ & elements Eric Meyer wrote: What's so interesting to me is that the guys who decided to focus on the positive went out and did something; those who want to mix in the negative seem to have nothing to offer except complaints. An excellent contrast between those who want to build new things and those who want to tear them down.

+ Conversation in XHTML Costello Well then who's on first? Abbott Yes. Costello I mean the fellow's name. Abbott Who. Costello The guy on first. Abbott Who.