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,

Slides:



Advertisements
Similar presentations
Cascading Style Sheets Color and Background Controls Border and Margin Controls (Boxes)
Advertisements

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.
Today’s objectives Site performance Padding, Margins, Borders
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.
Working with Cascading Style Sheets
方框的CSS樣式.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 6 - Cascading Style Sheets™ (CSS) Outline 6.1 Introduction 6.2 Inline Styles 6.3 Embedded Style.
 CSS Presentation and layout is based on the CSS Box Model.  The CSS Box Model states that every element on a page is a rectangular box.  This includes:
Cascading Style Sheets Part 3 Fall, 2007 Modified by Linda Kenney Nov. 12, 2007.
CSS Box Model margin border padding content 23. Box Model Properties PropertyValid valuesExample border-widththin, medium, thick, numberborder-width:
An Introduction to Cascading Style Sheets CSS Layout, and the CSS Box Model Nick Foxall SM5312 week 9: CSS Layout.
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.
Selectors thru Borders. CSS – Cascading Style Sheets – is a way to style HTML HTML is the content base of a web page CSS provides the presentation qualities.
Cascading Style Sheets 1 Color and Backgrounds. Cascading Style Sheets 2 Color and Backgrounds Computer color basics Expression of color values using.
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 CS3505. What are CSS? Method for adding style attributes consistently to HML tags Cascading because styles are applied in order.
Cascading Style Sheets Billy Toy Cascading Style Sheets Syntax review How to Implement style sheets Background properties Text properties.
CSS Dvijesh Bhatt.
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.
Cascading Style Sheets CSS. CSS - Structure Declaration block Property: identifies what to change Value: how to change it Selector – example h1{ font-size:
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorials 3 & 4: Working With CSS.
CSS Border.
Today’s objectives  Assignment 1  Padding, Margins, Borders  Fluid Layout page  Building accessible Table  Element size with padding and border 
Lecture # 33 Cascade Style Sheets (CSS). Cascade Style Sheets (CSS): Preserving a consistent “look and feel” of a website across multiple pages.
Adding Graphics to Web Pages. CSS does not have any properties specifically aimed at formatting images Use properties you have already learned, i.e.,
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 10: A Deeper Look at CCS- Spring 2011.
COMP213 – Web Interface Design
LITTLE BOXES Controlling size of boxes Box model for borders, margin and padding Displaying and hiding boxes.
Tutorial #6 – Creating Fixed Width Layouts. Tutorial #5 Review – Box Model Every html element is surround by a box Content, Padding, Border, Margin Can.
Lesson 03 // Cascading Style Sheets. CSS Stands for Cascading Style Sheets. We’ll be using a combination of Html and CSS to create websites. CSS is a.
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
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.
Cascading Style Sheets Chapters 5-6 Color and Background Controls Border and Margin Controls.
Cascading Style Sheets Part 3 Spring, 2008 Modified by Linda Kenney April 21, 2008.
Web Foundations THURSDAY, OCTOBER 3, 2013 LECTURE 6: CSS CONTINUED.
>> 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.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 6 - Cascading Style Sheets™ (CSS) Outline 6.1 Introduction 6.2 Inline Styles 6.3 Embedded Style.
 Cascading Style Sheets (CSS) ◦ Used to specify the presentation of elements separately from the structure of the document.  Inline style ◦ declare.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
1 CS428 Web Engineering Lecture 08 Border, Margin, Padding … (CSS - III)
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  CSS Box Model  CSS properties for border  CSS properties for.
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.
©SoftMoore ConsultingSlide 1 Introduction to HTML: Cascading Style Sheets.
CSS – Cascading Style Sheets
Extra-simplified.  Only truly happen when the CSS and HTML are defined as separate files (external style sheet) Introduction The main idea of CSS is.
Tutorial 4 Creating Page Layouts with CSS
CSS - Quiz #3 Lecture Code:
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring 2016 CSS Positioning 1.
Doncho Minkov Telerik School Academy schoolacademy.telerik.com Technical Trainer
HTML and Dreamweaver November 11th. Agenda Box Model Displaying and positioning elements – Padding – Margin – Float – Display – Position HTML Demo.
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.
CSS Box Model. What is the Box Model? Each XHTML element appearing on our page takes up a "box" or "container" of space. Each box size is affected not.
CIS 228 The Internet 10/18/11 Grouping XHTML. CSS Selectors Rule: selector-group { property-declaration* } Selector-group: selector *, Selector: simple-selector.
PERSPECTIVES: TUTORIAL 4 CREATING PAGE LAYOUTS WITH CSS.
CS 120: Introduction to Web Programming Lecture 10: Extra Features and Website Design Part 1 Tarik Booker CS 120 California State University, Los Angeles.
HTML & CSS Contents: the different ways we can use to apply CSS to The HTML documents CSS Colors and Background CSS Fonts CSS Text CSS box model: padding,
Unit 3 - Review. Topics 1. Tag, Attribute, Value 2. CSS Rule Syntax + link 3. Categories of Selectors 4. Inline vs Block Tags 5. CSS Layout 6. CSS Box.
Cascading Style Sheets Boxes
Cascading Style Sheets™ (CSS)
>> The “Box” Model
Cascading Style Sheets
CSS Borders and Margins.
CSS Boxes CS 1150 Fall 2016.
Cascading Style Sheets™ (CSS)
Presentation transcript:

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, list-style-image, list- style-position) Group Selectors, Descendant Selectors, Inheritence Nav Element, Span Element Classes (Dependent and Independent) Pseudo-Class Selectors for Links Margins

Working with the Box Model Box Model – describes the imaginary boxes that are formed around elements In HTML every element is treated as a box Box is 4 parts Content – Image, Text, Etc. There is no white space Padding – White space that surrounds the box content Border – Visible solid or decorated line around padding Margin – White space outside of the border.

Working with the Box Model

Padding and Margin Can be adjusted with em, px, %, or other measurements Set in CSS as the following for the same amount for each side: padding: width; Can set an individual side Padding-top Padding-right Padding-bottom Padding-left

Padding and Margin Can be adjusted with em, px, %, or other measurements Set in CSS as the following for the same amount for each side: margin: width; Can set an individual side Margin-top Margin-right Margin-bottom Margin-left

Padding and Margin - Shorthand One value – All four sides Equally Two Values – First value is Top and Bottom, second for left and right Three Values – Top, Left + Right, Bottom Four Values – Clockwise Top, Right, Bottom, Left Padding: 4px; Margin: 10px 4px; Padding: 4px 10px 4px; Margin: px;

Border Properties Border – Decoration around Content and Padding Can change color, style, and width May look different on the different browsers Can set border-style for all 4 styles or one side border-style: dotted thin red; /*sets border style, width and color all in one*/ Border-top-style Border-right-style (plus bottom and left)

Border Properties Border Styles – Page 247 shows examples Solid Double Dotted Dashed Groove Ridge Inset Outset None

Border Width Property Border width can be set in Thick Thin Medium Pixels, em, or % Recommended to use Pixels due to different browser rendering Border-width: 3px; /*sets all four sides*/ Border-top-width, Border-right-width, Border- bottom-width, border-left-width

Border Color Can set as Hex, RGB, or named color Like style and width can set all 4 or a specific side Border-color: red; Border-top-color: # 8C6B71;

Border Shorthand Border-color, border-style, border-width settings for all four sides Border-top, border-right, border-bottom, border-left Sets style, width, and color for the side specified. Just use Border to set all for sides with color, width, and style Border: solid thin red;

Float and Clear Float is used to position boxes on the page Can float left or right Floated elements are moved to the edge of the containing element (which could be the browser window) If multiple elements are floated and will not fit the browser will stack it right below the last floated element Float: right;

Float and Clear Clear is used to specify whether or not an element can have another floating element beside it Specifically the clear property specifies the sides where floating elements are not allowed Tells the browsers to “Clear” the previous float Options: Right, Left, Both, None Clear: both;

Float and Clear Can setup independent class for each float and clear.right{ float: right; }.left { float: left; }.clear { clear: both; }

Lab 1. Get Tutorial5_start.html from Class_info/lab 2. Add a dotted medium red border for h3 3. Add 10 pixel padding for h3 4. Make the image float to the left 5. Add a 10 pixel padding to the right of the image 6. Add a double thick black border to the image

Background Properties Background-image – Places an image behind the contents of an element Background-color – Places a color behind the contents of an element Background-position – Positions an image within an element. Set in pixel, em, or percent Background-repeat – Repeats and image to fill the contents of an element Background-attachment – Sets a background image to scroll with the cursor, or fixes the background with only elements on top of the background scrolling

Background Properties Shorthand: Background: image color position repeat attach

Background Properties Background-position – allows you to position a background image in different locations within its container element Keywords or % pairs (horizontal vertical) Top Left (0%,0%)Top Center (50% 0%)Top Right (100% 0%) Center Left (0% 50%)Center Center (50% 50%)Center Right (100% 50%) Bottom Left(0% 100%)Bottom Center (50% 100%)Bottom Right (100% 100%)

Background-repeat Use background-repeat to display copies of the image appear on the background PropertyEffect Repeat (default)The image is repeated (tiled) to the right and down to fill the elements contents. Repeat-xThe image is repeated only horizontally Repeat-yThe image is repeated only vertically No-repeatThe image is displayed once and not repeated

Background Attachment Allows you to set the behavior of the background image with respect to scrolling Defaults to image scrolling with the rest of the page Two values Scroll – Default Fixed

Lab 1. Get the smile.png from the class_info/labs/images 2. Add a background Image to the footer element. The footer CSS section already exists. 3. Set the url to images/smile.png 4. Set the position to 100% 100% 5. Set the repeat to only the y axis

CSS Precedence If there are conflicts in the CSS due to multiple styles there is a precedence to determine what is displayed The order of precedence from highest to lowest: 1. User-defined style – set by the user in web browsers 2. Inline styles 3. Embedded style sheets 4. External style sheets 5. Brower defaults

Pathnames Project Zip available on blackboard Also available on /CLASS_INFO/labs/ /CLASS_INFO/labs/