CSS Box Model.

Slides:



Advertisements
Similar presentations
HTML and CSS. HTML Hyper Text Markup Language Tells browser how to display text and images.
Advertisements

Very quick intro HTML and CSS. Sample html A Web Title.
4.01 Cascading Style Sheets
Web Design Transparent Backgrounds. Why : Allow text to appear clearly above a graphic background image that still can be seen in the background. Without.
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".
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
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.
 Word doc for you to download › Link at the beginning of class › 10 Questions › Answers to be added inline  Post to Sakai when completed › No resubmits.
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.
CSS Fun damentals The Document Hierarchy Element Relationships The Box Model.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  CSS properties for margin  CSS properties for dimensions (width,
HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.
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.
CONTROLLING Page layout
Chapter 5 pp HTML Elements & Attributes Format Content Or Examples This Text Is A Hyperlink.
Simple Website Layout Tutorial Using HTML 5 and CSS 3 Ref: layout-tutorial-html-5-css-3/
>> CSS Layouts. Recall Properties of Box – Border (style, width, color) – Padding – Margin – Display – Background – Dimension Welcome Padding Area Border.
CSS (Cascading Style Sheets). CSS CSS – Cascading Style Sheets – Cascade because of the way CSS rules can stack on top of each other. Allows you to add.
WebD Introduction to CSS By Manik Rastogi.
Laying out Elements with CSS
CSS Box Model.
CSS Box Model.
CSS Box Model.
Cascading Style Sheets Boxes
4.01 Cascading Style Sheets
Google fonts CSS box model
CSS Layouts: Grouping Elements
CSS3 Style of the HTML document CSS2+New Specifications Differences
CS1220 Web Programming Saloni Chacha.
Advanced CSS & CSS3.
Display Property.
Box model.
Web Systems & Technologies
BOX DIMENSIONS width, height div { height: 300px; width: 400px; background-color: #ee3e80;} p { height: 75%; width: 75%; background-color:
>> CSS Layouts.
CSS.
COMP 101 Review.
Chapter 6 More CSS Basics Key Concepts
Cascading Style Sheets
Basics of Web Design Chapter 6 More CSS Basics Key Concepts
TOPICS Chrome Dev Tools Process for Building a Static Website
CSS Borders and Margins.
MORE Cascading Style Sheets (The Positioning Model)
HTML5 Level I Session III
HTML5 Level I Session III
Box model, spacing, borders, backgrounds
CSS and Box Model.
CSS Box Model.
DynamicHTML Cascading Style Sheet Internet Technology.
Cascade Style Sheet Demo W3Schools. com: w3schools
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.
Grids, Floats & Flex Boxes
Putting it all together
Basics of Web Design Chapter 6 More CSS Basics Key Concepts
Web Development & Design Foundations with H T M L 5
DynamicHTML Cascading Style Sheet Internet Technology.
SEEM4570 Tutorial 3: CSS + CSS3.0
How to use the CSS box model for spacing, borders, and backgrounds
Box Model.
Building a website: Putting it all together
CSS Box Model.
CSS and Class Tools.
Laying out Elements with CSS
CSS Boxes CS 1150 Fall 2016.
4.01 Cascading Style Sheets
CSS Box Model.
CSS Box Model.
Cascading Style Sheets
ITI 133: HTML5 Desktop and Mobile Level I
Presentation transcript:

CSS Box Model

Every element is in box With very few exceptions, every element in HTML has a box that it is held in Can make it visible with background and border

Box Model Margin – clears an area around the border. Does not have a background color – it is transparent Border – a border that goes around the padding and content. Affected by the background color of the box. Padding – clears an area around the content. Affected by background color of the box Content – the content of the box, where text appears. Don’t forget to give the border some sort of style! <div> this is a div with some text <br/> In fact, this text has two lines <div> div { width:220px; padding:10px; border:5px solid gray; margin:0px; }

Content Padding Border Margin

No padding or border Rounded borders No padding borders or margins

Box Model Allows us to place borders, and space elements in relation to other elements Remember that border must have size, color and style Here’s where Inspect Element starts being important!

Box Model & Inspect Element Using Chrome tools helps you see the different parts

Centering centering the TEXT (within the box) text-align: center; centering the BOX Need to tell it to treat as a block display: block; Must have a width (px or %) display: table; computes it for you center using margin margin-left: auto; margin-right: auto;

Centering list items One of the areas with browser differences In some cases (Firefox), centering text centers the bullet In other cases (Chrome), centering text does not center the bullet Solution: list-style-position: inside; bullets INSIDE the list item’s formatting

A cool new feature Rounded corners on boxes border-radius: 15px; New with the latest version of CSS If not supported by a browser, you get square corners!