The Box Model.

Slides:



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

Client-Side Internet and Web Programming
More CSS CS HTML id attribute 2 Coding Horror! Our mission is to combine programming and “human” factors with geekiness! output  A unique ID for.
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 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.
1 Lesson Style Sheets Box Model Content (text,image,table) Margin Padding Border Box.
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.
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 Border.
Today’s objectives  Assignment 1  Padding, Margins, Borders  Fluid Layout page  Building accessible Table  Element size with padding and border 
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.
THE BOX MODEL Putting layouts together with CSS. The Box Model  How would you describe a box?  Container?  Tags or elements are “containers”  puts.
1 CS428 Web Engineering Lecture 08 Border, Margin, Padding … (CSS - III)
Cascading Style Sheets Positioning Controls Visibility.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  CSS Box Model  CSS properties for border  CSS properties for.
11/12/2015 Box Model Reed Crouch. 11/12/2015  HTML elements can be considered as boxes. In CSS, the term "box model" is used when referring to layout.
Copyright © Osmosys O S M O S Y SO S M O S Y S D e p l o y i n g E x p e r i e n c e & E x p e r t i s e™ CSS Training.
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.
CSS Table Styling. Up to this point, as we haven't applied any CSS styling to our tables, our example tables have not been too pleasing to the eye. CSS.
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,
Laying out Elements with CSS
CSS Box Model.
Chapter 6 - Cascading Style Sheets™ (CSS)
CSS Box Model.
Cascading Style Sheets Boxes
( Cascading style sheet )
Table Styling.
CSS Table Styling.
Table Styling.
CSS Layouts: Grouping Elements
Table Styling.
Unit 3 - Review.
Cascading Style Sheets
>> The “Box” Model
BOX DIMENSIONS width, height div { height: 300px; width: 400px; background-color: #ee3e80;} p { height: 75%; width: 75%; background-color:
CSS Applications to XML 19-Sep-18.
CSS Table Styling.
Objectives Create a reset style sheet Explore page layout designs
Cascading Style Sheets
CSS Borders and Margins.
Second CSS Lecture Applications to XML
HTML5 Level I Session III
HTML5 Level I Session III
Box model, spacing, borders, backgrounds
CSS Box Model.
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.
List Properties Box Properties Pseudoclass
Web Development & Design Foundations with H T M L 5
More CSS Page layout Boriana Koleva Room: C54
How to use the CSS box model for spacing, borders, and backgrounds
More CSS 22-Feb-19.
CSS Box Model.
CSS Boxes CS 1150 Fall 2016.
CS3220 Web and Internet Programming More CSS
Cascading Style Sheets
CSS Applications to XML 20-May-19.
CS3220 Web and Internet Programming More CSS
CSS Applications to XML 3-Jul-19.
ITI 133: HTML5 Desktop and Mobile Level I
Cascading Style Sheets™ (CSS)
CS3220 Web and Internet Programming More CSS
Presentation transcript:

The Box Model

What’s a Box? Any HTML Element Box can be “drawn” around it <p>This is my text</p> This is my text

Overview

Content Area Space taken up by content itself Content can have a specific width set to it Can be in either px or % (% of parent element) Example: h1{ width: 300px; }

Content Area -> More Content can have height set on it If you have more than fits in that height, must decide what to do with overflow – or it will bust past your borders

Content Area -> More overflow: hidden; Simply won’t show parts that won’t fit overflow: scroll; Picks up scroll bars on both directions overflow:auto Picks up scroll bars only if it needs them and only in direction it needs them

Content Area -> More Additional width & height controls max-height Allows to be smaller, but can’t expand past this min-height Allows to be larger, but can’t shrink past this max-width min-width

Padding Defines space between content area and border Will take on background color of content if it has color Can apply all around Or just to certain side

Padding -> More Control sides individually: Combined versions: padding-top: amt; padding-right: amt; padding-bottom: amt; padding-left: amt; Combined versions: padding: amt; Applies same amount to all 4 sides

Padding -> More Shorthand Versions padding: amt1 amt2; 1st number = top & bottom 2nd number = left & right padding: amt1 amt2 amt3; 1st number = top 3rd number = bottom padding: amt1 amt2 amt3 amt4; 2nd number = right 4th number = left Same order as a CLOCK

Border Outlines visible portion of element Can apply style, thickness, and color to it Can apply all around Or just to certain side

Border -> More Available Values for Borders border-color: color value; border-width: thin | medium | thick | amt in px border-style: dotted | dashed | solid | double | groove | ridge | inset | outset Can control independently ex: border-top-color:#f00;

Border -> More Shorthand Version Combined Versions border-top: color width style; Combined Versions Ex: border: 2px #f00 dotted; Applies to all borders

Margin Completely invisible No background color Will not obstruct elements behind it Can apply all around Or just to certain side

Margin -> More Units = px or % (% of container) Control independently (just like padding) margin-left, etc. Control in same combinations as padding with 1, 2, 3, or 4 values representing different sides Special value: auto Makes elements whose widths do not take up the entire page move to the middle!

Only applies to Content Area! Setting Dimensions Only applies to Content Area! Element{ width: 200px; border: 10px solid #99c; padding: 20px; margin: 20px; } Whole Rigmarole Consumes 300 px! 20px margin 20px margin 240px 200 content + 20 padding + 20 padding 10px border 10px border

Total Width Content area width + Left padding + Right padding + Left margin + Right margin+ Left border + Right border If aiming for a specific width, need to take into account all values

Quirk with Margins If stacked – top & bottom margins collapse together Will use value for larger margin when this happens.