The Box Model in CSS Web Design – Sec 4-8

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 Pages Week 10 This week: CSS Next week: CSS – Part 2.
Cascading Style Sheets
CSS Tips and Tricks for Designing Accessible Websites Presented by Grace Strother.
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
WEB DESIGN – SEC 4-11 PART OR ALL OF THIS LESSON WAS ADAPTED FROM THE UNIVERSITY OF WASHINGTON’S “ WEB DESIGN & DEVELOPMENT I ” COURSE MATERIALS PSEUDO-CLASS.
กระบวนวิชา 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.
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.
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.
Week 7 Web Typography. 2 Understanding Type Design Principles.
4.01 Cascading Style Sheets
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.
CSS Box Model. What is the CSS Box Model? The “Box Model” is a tool we use to lay out our web pages in a number of individual "boxes" or "containers".
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
Chapter 7 Web Typography Principles of Web Design, 4 th Edition.
CSS The Definitive Guide Chapter 8.  Allows one to define borders for  paragraphs  headings  divs  anchors  images  and more.
Chapter 12 Cascading Style Sheets: Part II The Web Warrior Guide to Web Design Technologies.
Intro to Dreamweaver Web Design Section 7-1 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Applying Color in CSS Web Design – Sec 4-5 Part or all of this lesson was adapted from the University of Washington’s “ Web Design & Development I ” Course.
Page Layout Styles Exploring Computer Science – Lesson 3-8 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
CONTROLLING Page layout
Stylizing a Navigational Menu Web Design Section 6-3 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
Chapter 7.  Change body and link styles  Create a drop-down menu  Change color and font styles in the menu  Create a pop-up effect using CSS  Utilize.
CSS.
Laying out Elements with CSS
Cascading Style Sheets (CSS)
CSS Box Model.
CSS Box Model.
CSS Box Model.
The Box Model in CSS Web Design – Sec 4-8
Cascading Style Sheets Boxes
4.01 Cascading Style Sheets
( Cascading style sheet )
CSS Layouts: Grouping Elements
CSS Rule Selector Declaration Block Value Attribute Name body {
Concepts for fluid layout
Intro to Dreamweaver Web Design Section 8-1
The Box Model in CSS Web Design – Sec 4-8
CSS Applications to XML 19-Sep-18.
Cascading Style Sheets
The Internet 10/13/11 The Box Model
CSS Borders and Margins.
Second CSS Lecture Applications to XML
Web Development & Design Foundations with H T M L 5
CSS Box Model.
CMPE 280 Web UI Design and Development September 4 Class Meeting
Float Property Elements that seem to “float" on the right or left side of either the browser window or another element are often configured using.
Web Development & Design Foundations with H T M L 5
Cascading Style Sheets™ (CSS)
How to use the CSS box model for spacing, borders, and backgrounds
More CSS 22-Feb-19.
CMPE 280 Web UI Design and Development February 7 Class Meeting
CSS Box Model.
Principles of Web Design 5th Edition
Laying out Elements with CSS
CSS Boxes CS 1150 Fall 2016.
CS3220 Web and Internet Programming More CSS
Cascading Style Sheets
Concepts for fluid layout
4.01 Cascading Style Sheets
CSS Box Model.
CSS Box Model.
CSS Applications to XML 20-May-19.
CSS Applications to XML 3-Jul-19.
Cascading Style Sheets™ (CSS)
Positioning Boxes Using CSS
CMPE 280 Web UI Design and Development September 5 Class Meeting
CGS 3066: Web Programming and Design Fall 2019 CSS Part 2
Presentation transcript:

The Box Model in CSS Web Design – Sec 4-8 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course materials

Objectives The student will: Be able to identify the difference between margin, border, and padding in CSS. Be able to add margins, borders, and paddings to HTML elements using CSS.

Units in CSS code Before you understand boxes in CSS code you need to understand measurements on a web page…

Understanding CSS Units of Measure Values can be expressed in absolute terms. For instance something can be declared to be an exact number of pixels (px) or points (pt). A pixel is one dot on the computer screen, and a point is equal to 1/72 of an inch, which is measure better suited for print documents than for computer screens.

Understanding CSS Units of Measure Values can also be declared in relative terms such as percent (%). For example, the font-size for the body might be set to 100%, which is the default font size in the user's browser. If the h1 font-size property is set to 180%, that's 80% larger than the rest of the body. One "em" is the size of the letter "M" in the user's current font. If you set a font size to 1.8em, that’s 1.8 times the default size

Understanding CSS Units of Measure % and em are relative because the default font varies from computer to computer. Relative values are generally better to use because they are scalable; they grow and shrink as needed to best fit given the user's screen resolution, window size, and default browser font size. If you use 12px to specify font size, that may look fine to most users on a computer screen, but it will be tiny on a high resolution cell phone!

The Box Model in CSS These are the layers in the Box Model: The size of each of the layers in the box model can be specified using the usual CSS units of measure (em, %, and px).

If you have this HMTL code: The Box Model in CSS If you have this HMTL code: <div> <p> This is a paragraph. It is a very short paragraph. </p> </div> And this CSS code: div { background-color: red; padding: 0; border: 1px solid black; margin: 0; } p { background-color: white; padding: 1em; border-width: 10px; border-style: solid; border-color: blue; margin: 10px !important; }

Tips You can specify one value for padding, border, or margin (for example, padding:5px), and that value will apply to all sides of the box. Alternatively, you specify a unique value for each side, such as padding-left, border-right, and margin-right. For padding and margin, you can use shorthand by specifying each of the four sides in a single style declaration, like this: padding: 1em 1.5em 5% 10px; The four values are for the top, right, bottom, and left (clockwise around the box, starting at the top)

Borders can also be specified using shorthand, like this: border: 1px solid black; These three values represent the border-width, border-style, and border-color. Border styles are:

Finish adding fonts into your CSS code. Turn in the font worksheet. Rest of Today Finish adding fonts into your CSS code. Turn in the font worksheet. Download the instructions for today. Add borders, margins and paddings. Add CSS code to stylize the table in your accesibility.hmtl file.