COS 125 DAY 20. Agenda  Assignment 5 corrected 3 A’s, 4 B’s, 1 D and 1 F’s 4 late -20 points per day Time of submission is the later of the.

Slides:



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

LIS650 lecture 4 Thomas Krichel today Advice CSS Properties –Box properties –List properties –Classification properties Fun with selectors.
Quiz #3 - CSS Lecture Code: Get Neighbors’ URLs for MP1
Cascading Style Sheets Color and Background Controls Border and Margin Controls (Boxes)
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.
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 5 Working with the Box Model. XP Objectives Understand the box model Create padding, margins, and borders Wrap text around an image Float a block-level.
CSS: Class 1 Background Images, Controlling Position of Background Images, Add Padding to Page Elements, Add Borders to Elements on a Page.
Tutorial 6 Creating Fixed-Width Layouts
TUTORIAL 4: CREATING PAGE LAYOUT WITH CSS Session 4.3.
Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.
COS 125 DAY 19. Agenda  Assignment #6 Due April 7  Next Capstone Progress Report Due April 7  Next Quiz (Quiz #4) April 11 Castro Chap 8, 9, 10, 11.
Cos 125 Day 22. Agenda Assignment 6 Not corrected Waiting for tune-ins Assignment 7 is posted Assignment 7 Due April 2PM Left to do 1 Assignments.
Cos 125 Day 24. Agenda All students meeting 7 Pm Monday, April 19 UMS Strategic Plan Assignment #7 Posted Due April 20 Two (one?) more to go Quiz Four.
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)
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.
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 11: Layout with Styles.
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.
Dreamweaver -- CSS. Dreamweaver -- MX New icons are added in MX Most of the features commonly used in web design, and are same as FrontPage. New feature.
CSS Positioning Creating Special Effects with CSS CS202 Working with Cascading Style Sheets (Chapter 4) CS202 1.
COS 125 DAY 12. Agenda  Assignment 5 Corrected 7 A’s & 2 B’s No one got the 10 bonus points  Required that all rules were correct  test5.txt test5.txt.
The Missing Manual MARGINS, PADDING, & BORDERS—CHAPTER 7.
CSS The Definitive Guide Chapter 8.  Allows one to define borders for  paragraphs  headings  divs  anchors  images  and more.
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.
CSCE 102 – Chapter 6 (Web Design and Layout) CSCE General Applications Programming Benito Mendoza Benito Mendoza 1 By Benito Mendoza.
Tutorial #6 – Creating Fixed Width Layouts. Tutorial #5 Review – Box Model Every html element is surround by a box Content, Padding, Border, Margin Can.
INTRODUCTORY Tutorial 4 Exploring Graphic Elements and Images.
Cascading Style Sheets Chapters 5-6 Color and Background Controls Border and Margin Controls.
COS 125 DAY 11. Agenda  Assignment 4 corrected 8 A’s & 2 B’s  Assignment 5 Due  Assignment 6 will be posted after break  Quiz 1 corrected 1 A, 5 B’s,
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.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
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)
Cascading Style Sheets Positioning Controls Visibility.
INTRODUCTORY Tutorial 5 Using CSS for Layout and Printing.
Positioning and Printing Creating Special Effects with CSS.
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.
Cascading Style Sheets Positioning Controls Visibility.
Tutorial 4 Creating Page Layouts with CSS
CSS - Quiz #3 Lecture Code:
Doncho Minkov Telerik School Academy schoolacademy.telerik.com Technical Trainer
CIS234A Lecture 6 Instructor Greg D’Andrea. Span and Div The span and div elements are a generic means by which we can add structure to documents. The.
Tutorial #5 Working with the Box Model. Tutorial #4 Review - CSS Create a homework page Final Project Discussion Exam on Blackboard Styling Lists (List-style-type,
CS 120: Introduction to Web Programming Lecture 10: Extra Features and Website Design Part 1 Tarik Booker CS 120 California State University, Los Angeles.
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 Boxes
Cascading Style Sheets™ (CSS)
CSS Layouts: Grouping Elements
Cascading Style Sheets
>> The “Box” Model
Advanced CSS BIS1523 – Lecture 20.
CSS Applications to XML 19-Sep-18.
Objectives Create a reset style sheet Explore page layout designs
Cascading Style Sheets
Controlling Layout with Style Sheets
CSS Borders and Margins.
Second CSS Lecture Applications to XML
MORE Cascading Style Sheets (The Positioning Model)
More CSS 22-Feb-19.
Floating and Positioning
COS 125 DAY 20.
CSS Boxes CS 1150 Fall 2016.
CSS Applications to XML 20-May-19.
CSS Applications to XML 3-Jul-19.
Cascading Style Sheets™ (CSS)
Presentation transcript:

COS 125 DAY 20

Agenda  Assignment 5 corrected 3 A’s, 4 B’s, 1 D and 1 F’s 4 late -20 points per day Time of submission is the later of the time when assignment file is uploaded in blackboard or the last time the file on the web server is modified  Assignment 6 is posted Due April 2PM (Next Class)  Left to do 2 Assignments (8 total)  One per week 1 Quiz Capstone projects  Lecture/Discuss Layout with Styles

Tips for Assignment #6  For assignment #6 I gave you a xHTML page with lots of text and various elements  You cannot modify the xHTML page other than associating with different style sheets  You will have create several different style sheets to format this page Style sheets will be IAW formatting rules I give you  You will have to produce a menu that shows the same pages formatted with each different style sheet

Layout with Styles  Allows for more possibilities than xHTML layout  Can create Liquid layouts that expand or contract with browser window  Separate layout from Content allowing you to change layout without re-coding WebPage  Examples of everything in this lecture available at

Structuring Your Pages  Divide your page in logical sections using the element  Name each division using the id attribute id=“daName”  Put the sections in order in your XHTML page  Use headers (h1, h2, h3 etc ) in a consistent fashion

The Box Model  For CSS, every element is in an invisible Box that has the following Content (middle) Padding (between Content & Border) Border (around element) Margin (Between element border and next element)  Boxes are either block level (new paragraph) or inline (on same line)  xHTML flow from top to bottom with line breaks around block level elements

Box Model (inline) Margin Border Padding Content Margin Border Padding Content

Box Model (block) Margin Border Padding Content Margin Border Padding Content

Changing backgrounds  Every element including the page itself can have its own background  To set background color selector{background-color:”blue” or “#336677” or rgb(200,100,34) or transparent}  To use a background image selector{background-image:url(image.gif)} If you use both color and image the color will be used until the image is loaded and will be seen through any transparent parts of the image  To repeat background image background-repeat:repeat or repeat-x or repeat-y or no-repeat  To fix background relative to element background-attachment:fixed or scroll  To specify position of background background-position: x y  To do all at once background:url(image.gif) repeat-x fixed bottom left;  Default setting background:transparent none repeat scroll top left

Changing the foreground color  selector{color:colorname or #rrggbb or rgb(r,g,b) or rgb(r%, g%, b%)  Foreground doesn’t work on image (img) element

Setting the height and width of elements  You can set the height and width as a absolute values or relative to parent element  Selector{width:w;height:h}  Setting width or height to auto allows the browser to calculate  Exampes #banner{width:100%; height:auto} img{width:200px, height:auto} a:link{width:100px height:50px}

Setting margins  Margins are outside of the border  Selector{margin:x} X = size in px (10px) or relative (2em) or percentage (10%)  Can also set margin by side margin-top:x margin-left:x  If two elements with margins touch, the space between their borders is the larger of the two margins and not the sum of the two margins

Adding padding  From inside out of an element Content, padding, border, margin  Selector{padding:x} X = size in px (10px) or relative (2em) or percentage (10%)  Can also set padding by side padding-top:x padding-left:x Margin Border Padding Content

Setting the Border  Every element can have a border  Border-style: type Type can be dotted, dashed, solid, double, groove, ridge, inset, or outset  Border-width: Npx If you give 4 values one value you can modify each side Border-width: 2px 3px 4px 5px Top = 2, right= 3, bottom = 4, left = 5  Border-color: colorname or #rrggbb or rgb(r,g,b) or rgb(r%,g%,b%)  Can also just effect one side using border-top-style:  Shorthand border-side-property: value(s)  Border-top-color:blue;  Border-right-style:groove;

Controlling the flow (position)  4 ways to position an element box Static – with the flow Absolute – in a fixed position relative to parent element Fixed – in a fixed position relative to browser Relative – with respect to default position in the flow  If boxes overlap you can control which goes over which using z-index

Offsetting Elements in the Natural flow  Every element as a “natural” location based on page flow  You can moved the an element relative to its natural position  Does not effect any other element in page Selector{Postion:relative; top:v; left:v; bottom:v; left:v} V is desired distance you want offset from natural location in absolute (12px) or relative values (1em, 1.5em) Can cause overlaps

Positioning Elements Absolutely  Elements in a xHTML web page flow in the order they appear in the xHTML  You can take them out of the flow and position them wherever you want with respect to their parent Selector{postion:absolute; top:v or bottom:v; left:v or right:v}  Generally you use  top or bottom  left or right V is desired distance you want offset from parent in absolute (12px) or relative values (1em, 1.5em) or as a percentage of parent (10%) Can cause overlaps Percentages create “liquid” layouts

Fixing an Element in the Browser Windows  Cause an element to fixed..doesn’t move when the page is scrolled  Works in IE7, FireFox and Opera Selector{Postion:fixed; top:v; left:v; bottom:v; left:v} V is desired distance you want offset from browser in specific (12px) or relative to parent values (1em, 1.5em) or as a percentage of browser (10%) Can (and most likely will) cause overlaps

Making elements float  You can make elements “float” in a “sea” of text  This property has buggy results  Selector{float:left or right) Elements “float” in the direction selected  If more than one element is floated in the same direction they will stack in the order they appear in xHTML Float left Float right

Controlling whether or not elements can floats next to another  If you don’t want anything float to the left right or both of a particular element Selector{clear:left or right or both}  Example #banner{clear:both} #blockhouse{clear:left}

Positioning elements in 3D  You can effect in which “layer” each element appears  Very important when you have overlap  selector{z-index:n} The highest n goes on top The lowest n goes to the bottom Think of n as the elevation of the element  Children will assume the z-index of parent first then will be in “Z” order versus their siblings

Changing the cursor  You can set how the cursor looks in each element Browser and O/S dependant  Selector{cursor:value} Value can be  Pointer  default  crosshair  move  wait  help  text  x-resize  X can be n, s e or w or combinations

Determining Overflow  What happens when the content of an element is larger than the “box” you have created for it??  Condition can be controlled via overflow property  Selector{overflow:value} Value can  Hidden (what ever doen’t fit becomes invisible)  Visible (makes the box fit the contents)  Scroll (forces scroll bars)  Auto (scroll bars only when necessary)  Problems with IE 6 works in IE7

Aligning Elements Vertically  Selector{vertical-align:value}  Value can be baseline -- bottom of element lines up with bottom of parent middle -– middle of element lines up with middle of parent sub – lines up below parent super –lines up above parent text-top – top of element aligns to top of parent text-bottom – align the bottom of element to bottom of parent top –aligns top of element to top of tallest element in the same line bottom- aligns bottom of element to bottom of lowest element in the same line

Displaying and Hiding Elements  You can control how the browser display an element using the property display: h1{display:”value”}  Values can be none hides the element block displays element as block level inline displays the element as inline list-item displays the element as though you has used tag (covered later)

Cool CSS effects  Rollover buttons examples/css-effects/rolloverbuttons.html examples/css-effects/rolloverbuttons.html  image “pop-ups” examples/css-effects/popups.html examples/css-effects/popups.html  Drop down menus examples/css-effects/dropdownmenus-noformat.html examples/css-effects/dropdownmenus-noformat.html examples/css-effects/dropdownmenus.html examples/css-effects/dropdownmenus.html  Replacing headers with Images (not for IE) examples/css-effects/imagereplacement.html examples/css-effects/imagereplacement.html  More effects

Learning Objectives  Use Media-specific style sheets  Understand the difference between screen and print styles  Specify when pages will break in a style sheet for printing  Identify print-specific properties using rule.

Media-Specific Style Sheets  You can designate a stylesheets to be used only for printing, for screen display or for both.  Use attribute “media=“print” or “screen” or “all” in the open link or style tag  You can also import “print.css” print;  Example

How Print Style Sheets Differ  Can be the same or very different from screen version  Some suggestions Use points instead of pixels for sizing  12points instead of 15px Hide sections like sidebars, banners or ads  display:none Remove background colors and images Adjust margins Set page breaks Let viewers know that printouts are different than viewed pages Test the print out (print preview) and adjust if necessary

Controlling Page Breaks  WebPages can be very long  Use CSS to control where the contents are printed relative to printer page  Where page breaks occur Page-break-before:values Page-break-after:values Page-break-inside:values Values are “auto” “always” or “avoid”  Examples p{page-break-inside:avoid} h1,h2,h3{page-break-before:always}

Other print Specific CSS properties  These do not work in IE or Netscape (yet!)  You can predefine printing :left or :right or :first “name”{ stuff } Stuff can be  Size:w h w=width of page h=height of page  Margin:x  Marks:kind  Any other property:value pairs Example :first{size 8.5in 11in; margin:1in marks:none} legal{size 8.5in 14in; margin 1in 0.5in 1in 0.5in}  Use predefined rule Selector{page:legal;}

Widows and Orphans  Orphan is a term used to describe a single word appearing at the bottom of a paragraph or column.  A widow is a single word or short phrase appearing alone at the top of column.  To modify using css Selector{orphans:n} Selector{widows:n} N is minimum number of lines to appear at the top (widow) or bottom (orphan) of a page  p{orphans:4;widows:4}