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.

Slides:



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

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.
Client-Side Internet and Web Programming
CIS 1310 – HTML & CSS 6 Layout. CIS 1310 – HTML & CSS Learning Outcomes  Describe & Apply the CSS Box Model  Configure Float with CSS  Designate Positioning.
CSS normally control the html elements. Three Ways to Insert CSS There are three ways of inserting a style sheet: External style sheet Internal style.
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.
Tutorial 4: Creating page layout with css
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.
Basic use of columns is to organize a list of navigation links down the left or right side of the page next to a main content area. (Fig. 1) Another common.
CSS Box Model margin border padding content 23. Box Model Properties PropertyValid valuesExample border-widththin, medium, thick, numberborder-width:
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.
Web Development & Design Foundations with XHTML Chapter 6 Key Concepts.
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.
MCS 270 Cascading Style Sheets (CSS) Gustavus Adolphus College.
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.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorials 3 & 4: Working With CSS.
CSS Border.
Css ( CASCADING STYLE SHEETs ) CSS Box Model. All HTML elements can be considered as boxes. In CSS, the term "box model" is used when talking about design.
Chcslonline.org Text –wrapping around Images. chcslonline.org To wrap text around an image, lets set up a style in our style sheet. open a new notepad.
INTRODUCTORY Tutorial 4 Exploring Graphic Elements and Images.
Part 4 Introduction to CSS. CSS Table Table Borders table, td, th { border:1px solid black; } Firstname Lastname Bader Ali Paul Manuel The example below.
Web Foundations THURSDAY, OCTOBER 3, 2013 LECTURE 6: CSS CONTINUED.
1 CS428 Web Engineering Lecture 08 Border, Margin, Padding … (CSS - III)
Table Styling. Using CSS to Style Tables: So far, our table styling - such has "width" and "border" - has not used CSS. CSS provides us with many tools.
Cascading Style Sheets (CSS) Part II IT210: Web-based IT.
آموزش طراحی وب سایت جلسه پنجم– سی اس اس 2 تدریس طراحی وب برای اطلاعات بیشتر تماس بگیرید تاو شماره تماس: پست الکترونیک :
CONTROLLING Page layout
Positioning Elements CHAPTER 3 1 CHARLES WYKE-SMITH: STYLIN’ WITH CSS: A DESIGNER’S GUIDE (3 ND EDITION)
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.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring 2016 CSS Positioning 1.
- WE’LL LOOK AT THE POSITION PROPERTY AND HOW CSS RESOLVES CONFLICTS BETWEEN STYLING INSTRUCTIONS The position property; CSS specificity hierarchy.
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,
Cascading Styles Sheets Positioning HTML elements.
Laying out Elements with CSS
The Box Model in CSS Web Design – Sec 4-8
Cascading Style Sheets Boxes
Table Styling.
Table Styling.
The Box Model in CSS Web Design – Sec 4-8
CSS Layouts: Grouping Elements
Table Styling.
>> The “Box” Model
Cascading Style Sheets (Layout)
CSS Applications to XML 19-Sep-18.
Objectives Create a reset style sheet Explore page layout designs
6 Layout.
Creating Layouts Using CSS
Cascading Style Sheets
CSS Borders and Margins.
Second CSS Lecture Applications to XML
MORE Cascading Style Sheets (The Positioning Model)
More CSS Page layout Boriana Koleva Room: C54
More CSS 22-Feb-19.
Floating and Positioning
Web Design & Development
Laying out Elements with CSS
CSS Boxes CS 1150 Fall 2016.
CSS Applications to XML 20-May-19.
CSS Applications to XML 3-Jul-19.
Cascading Style Sheets™ (CSS)
Positioning Boxes Using CSS
CGS 3066: Web Programming and Design Fall 2019 CSS Part 2
Presentation transcript:

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 the box model, the position property, and the display property. Box Model  Describes the positioning controls that exist for every element in your markup. Position property  Defines the positional relationship between these elements on the page. Display property  Determines whether elements stack or sit side-by- side, or even display on the page at all.

Every element created in the markup produces a box on the page. Three aspects of the box are able to be modified with CSS: Border  Can set the thickness, style, and color. Margin  Can set the distance between this box and adjacent ones. Padding  Can set the distance between content and border.

Border has three associated properties: Width. Values: thin, medium, think, or any unit. Style. Values: none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset. Color. Values: any color value (RGB, hex, keyword). p.warning {border-width:4px;} p.warning {border-style:solid;} p.warning {border-color:#F33;} If you want to set all 4 sides with the same width, style, and color, you can use the shorthand “border” to specify them all in one fell swoop: p.warning {border:4px solid #F33; padding:2px;} Or if you want different widths on different sides: p.warning {border-width:4px 2px 2px 4px;} – Will set the right and bottom borders 2px, while keeping the others 4px. (Order is clockwise).

Padding adds space between the box’s border and its content. Replaces the old, messy method of using spacer GIF’s. p.warning {padding:4px;} Margins add space between boxes. If the margin is 0, the boxes touch one another. Good practice to put * {margin:0; padding:0;} at the very beginning of your style sheet. Vertical Margins Collapse  When a top margin of one element meets the bottom element of another margin, they overlap until one of the margins touches the border of the other element.

Width  Sets the width of the element box. Adding padding, borders, or margins to an element box with a defined width will increase in size to accommodate that width. E.g. p {width:400px; padding:0 20px; border:#000 solid: border-width: 0 6px 0 6px; background-color:#CCC;} Total width of the element is: = 452 If you wanted to increase the padding inside the box but not make it any bigger, use a div inside the p and increase the padding on that. That will keep the outer box at a constant width while allowing you to modify the inner content’s formatting.

Float  Moves an element out of the normal flow of the document. Elements that follow a floated one will move up and sit next to it if there’s room. Clear  Stops elements from moving up next to a floated property. img {float:left; margin:0 4px 4px 0;} You can use float to form columns by declaring them floating in style declarations. Adding float to the p tag in this example will put the paragraph beside the img: img {float:left; margin:0 4px 4px 0;} p {float:left; width:200px; margin:0;}

Sometimes floating will distort the page. Adding a div before the distorting floated element with a class to “clear” will set the element below the floating ones..clearfloats {clear:both;} Some floated text

Position property determines the reference point for the positioning of each element box. Four values for the position property: Static  Each element is laid out one after the other Absolute  Allows you to specify an exact position with respect to the top-level element. Fixed  Same concept as absolute, though it will not move if the browser is scrolled. Relative  Allows you to specify how much you want to move your element with respect to its previous position.

The default. Elements laid out one after another. #specialpara {position:static;}

Move the paragraph with respect to its default position. Can set its top, bottom, left, or right, but usually top and left are all that’s needed. #specialpara {position:relative; top:30px; left:20px;}

Move the paragraph with respect to the top level element (body). Can set its top, bottom, left, or right, but usually top and left are all that’s needed. #specialpara {position:absolute; top:30px; left:20px;}

Move the paragraph with respect to the top level element (body), but affix it on the screen so it doesn’t move when the page is scrolled. Can set its top, bottom, left, or right, but usually top and left are all that’s needed. #specialpara {position:fixed; top:30px; left:20px;}

In order to set an element’s position with respect to a higher-up-the-tree element’s position, you must specify relative for the higher and absolute for the lower. div#outer {position:relative; width:250px; margin:50px 40px; border-top:3px solid red;} div#inner {position:absolute; top:10px; left:20px; background;#AAA;}

The display property can change elements from inline to block and vice versa. Can also hide an element completely (and remove the space it held). p {position:absolute; display:none; width:80px; left:96px; top:35px; border:1px solid gray; padding:.3em; background-color:$FFD;} div {border:2px solid #069;} div:hover p, p:hover {display:block;} This is some awesome text that just appeared out of no where! Hover your mouse over the box!