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.

Slides:



Advertisements
Similar presentations
HIGH LEVEL OVERVIEW: CSS CSS SYNTAX CONSISTS OF A SET OF RULES THAT HAVE 3 PARTS: A SELECTOR, A PROPERTY, AND A VALUE. IT’S NOT NECESSARY TO REMEMBER THIS.
Advertisements

Web Engineering 1 Ishaq Khan Shinwari MCS City University Peshawar.
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
Cascading Style Sheets
Today CSS HTML A project.
CSS. Intro to CSS Cascading Style Sheets – styles and enhances appearance of webpage.css extension.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 4 Key Concepts 1 Copyright © Terry Felke-Morris.
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.
INTRODUCTORY Tutorial 7 Creating Liquid Layouts. XP Objectives Discern the differences among various types of layouts Create a liquid layout Create a.
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
กระบวนวิชา CSS. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
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.
Tutorial 4: Creating page layout with css
CSS: Class 1 Background Images, Controlling Position of Background Images, Add Padding to Page Elements, Add Borders to Elements on a Page.
 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.
XP Introducing Cascading Style Sheets With Cascading Style Sheets (CSS), you can create one or more documents that control the appearance of some or all.
INTRODUCTORY Tutorial 3 Using CSS to Format Multiple Pages.
Chapter 7 Using Advanced Cascading Style Sheets HTML5 & CSS 7 th Edition.
Tutorial 3 Working with Cascading Style Sheets. XP Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external.
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
4.01 Cascading Style Sheets
Working with Cascading Style Sheets. 2 Objectives Introducing Cascading Style Sheets Using Inline Styles Using Embedded Styles Using an External Style.
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
XP Tutorial 7New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks.
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.
 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.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Tutorial 7.
 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.
Cascading Style Sheets Chapters 5-6 Color and Background Controls Border and Margin Controls.
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.
INTRODUCTORY Tutorial 3 Using CSS to Format Multiple Pages.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with 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.
CNIT 132 – Week 4 Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of.
Tutorial 4 Creating Page Layouts with CSS
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,
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
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,
CSS. What does it stand for? ___________________.
CSS. What does it stand for? Cascading Style Sheet.
CSS Introductions. Objectives To take control of the appearance of a Web site by creating style sheets. To use a style sheet to give all the pages of.
CSS.
Working with Cascading Style Sheets
Chapter 6 - Cascading Style Sheets™ (CSS)
Cascading Style Sheets Boxes
Cascading Style Sheets™ (CSS)
4.01 Cascading Style Sheets
( Cascading style sheet )
>> The “Box” Model
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Cascading Style Sheets
The Internet 10/13/11 The Box Model
CSS Borders and Margins.
Training & Development
Tutorial 3 Working with Cascading Style Sheets
CSS Boxes CS 1150 Fall 2016.
4.01 Cascading Style Sheets
Cascading Style Sheets™ (CSS)
Presentation transcript:

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 element New Perspectives on Blended HTML, XHTML, and CSS2

XP Objectives Use the background properties Create a background image for a list Create an external style sheet Link to an external style sheet New Perspectives on Blended HTML, XHTML, and CSS3

XP Understanding the Box Model The CSS box model describes the boxes that are formed around elements in a Web page – The content area is the area that contains the box content – The box properties are used to add white space and a border around the content – Padding is the white space that surrounds the box content – A border can be placed around the padding – The margin is white space outside the border Creates breathing room New Perspectives on Blended HTML, XHTML, and CSS4

XP Understanding the Box Model New Perspectives on Blended HTML, XHTML, and CSS5

XP Understanding the Padding and Margin Properties Padding properties control the internal white space Setting padding: To set the padding within an element, use: padding: width; where width is the size of the padding using one of the CSS units of measure. New Perspectives on Blended HTML, XHTML, and CSS6

XP Understanding the Padding and Margin Properties The margin properties control the external white space Setting margins: To set the margin space around an element, use: margin: width; where width is the size of the margin usingone of the CSS units of measure. New Perspectives on Blended HTML, XHTML, and CSS7

XP Understanding the Padding and Margin Properties New Perspectives on Blended HTML, XHTML, and CSS8

XP Understanding the Padding and Margin Properties Border properties place a decorative border around the contents of an element New Perspectives on Blended HTML, XHTML, and CSS9

XP Understanding the Padding and Margin Properties Setting the appearance of all four borders at once To set the border width, use: border-width: width; where width is one of the CSS units of measure. To set the border color, use: border-color: value; where value is a named color, RGB color, or hexadecimal color value. To set the border style, use: border-style: style; where style is either none, solid, double, dotted, dashed, outset, inset, groove, or ridge. New Perspectives on Blended HTML, XHTML, and CSS10

XP Understanding the Padding and Margin Properties – To use the border shorthand property, enter: border: style color width; where style is the border style, color is the border color, and width is the border width. New Perspectives on Blended HTML, XHTML, and CSS11

XP Using the Float Property The CSS classification properties allow you to control how to display and position an element, and how to control visibility – Float property – Clear property Using the float property: To float an element, use the style: float: position; where position is left, right, or none. New Perspectives on Blended HTML, XHTML, and CSS12

XP Using the Float Property New Perspectives on Blended HTML, XHTML, and CSS13

XP Using the Clear Property To clear past an element, use the following style: clear: position; where position is left, right, or both. New Perspectives on Blended HTML, XHTML, and CSS14

XP Using the Clear Property New Perspectives on Blended HTML, XHTML, and CSS15

XP Understanding the Background Properties The background properties set the background effects for an element background-image—Place an image behind the contents of an element. The image can be any GIF, PNG, or JPEG image, but the syntax must be in the form url(imagename.gif) background-color—Place a color behind an element’s contents background-position—Position an image within an element. Use keywords or pixel, em, or percentage values. New Perspectives on Blended HTML, XHTML, and CSS16

XP Understanding the Background Properties background-repeat—Repeat an image horizontally or vertically (or both) to fill the contents of an element. background-attachment—Have a background image scroll with the cursor. background—Use this shorthand property to change all of the background properties. Values (if used) must be listed in this order: image value, color value, position value, repeat value, and attachment value. New Perspectives on Blended HTML, XHTML, and CSS17

XP Understanding the Background Properties The background-position property allows multiple values: New Perspectives on Blended HTML, XHTML, and CSS18

XP Understanding the Background Properties The background-repeat property has copies of an image appear behind an element New Perspectives on Blended HTML, XHTML, and CSS19

XP Understanding the Background Properties The background property allows you to specify any or all of the background properties – image, color, position, repeat, and attachment New Perspectives on Blended HTML, XHTML, and CSS20

XP Understanding the Background Properties New Perspectives on Blended HTML, XHTML, and CSS21

XP Resolving Style Conflicts Using different types of style sheets can result in style conflicts Style precedence determines the order of the cascade in Cascading Style Sheets – Five sources for styles User-defined styles Inline styles Embedded style sheet styles External style sheet styles The browser’s style sheet New Perspectives on Blended HTML, XHTML, and CSS22

XP Understanding External Style Sheets Separate file from the Web page Create a new file for the external style sheet, and include a CSS comment at the top of the page to document the author name and the creation date. Do not enter any XHTML code in this file. Switch to the XHTML file. In the embedded style sheet, delete the start and end style tags. In the XHTML file, cut the CSS code from the embedded style sheet and paste the code into the CSS file. New Perspectives on Blended HTML, XHTML, and CSS23

XP Understanding External Style Sheets Save the CSS file with a.css filename extension and close it. In the section of the XHTML file, enter the following code to link to the external CSS file: where filename.css is the name of the external style sheet file. New Perspectives on Blended HTML, XHTML, and CSS24

XP Understanding External Style Sheets New Perspectives on Blended HTML, XHTML, and CSS25

XP Understanding External Style Sheets New Perspectives on Blended HTML, XHTML, and CSS26

XP Understanding External Style Sheets To create a link to a CSS file, enter the following code between the tags in an XHTML document: where the rel attribute and its value specify the link to a style sheet file, the href attribute and its value identify the CSS file that is the source of the style code, and the type attribute and its value identify a text file. New Perspectives on Blended HTML, XHTML, and CSS27

XP Understanding External Style Sheets New Perspectives on Blended HTML, XHTML, and CSS28