>> 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

Web Pages Week 10 This week: CSS Next week: CSS – Part 2.
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
CSS. Intro to CSS Cascading Style Sheets – styles and enhances appearance of webpage.css extension.
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.
Cascading Style Sheets By: Valerie Kuna. What are Cascading Style Sheets? Cascading Style Sheets (CSS) are a standard for specifying the presentation.
With CSS, a color is most often specified by: a HEX value - like "#ff0000" an RGB value - like "rgb(255,0,0)" a color name - like "red“ Example h1.
CIS 1310 – HTML & CSS 6 Layout. CIS 1310 – HTML & CSS Learning Outcomes  Describe & Apply the CSS Box Model  Configure Float with CSS  Designate Positioning.
กระบวนวิชา 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.
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)
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.
Style sheets can also affect the BODY. style4.css BODY {BACKGROUND-COLOR : white} H1 {COLOR : red; FONT-SIZE : 50; FONT-FAMILY : arial} H2 {COLOR : green}
Style sheets can also affect the body. style4.css body {background-color : white} h1 {color : red; font-size : 50; font-family : arial} h2 {color : green}
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.
CSS The Definitive Guide Chapter 8.  Allows one to define borders for  paragraphs  headings  divs  anchors  images  and more.
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorials 3 & 4: Working With CSS.
CSS Border.
Cascading Style Sheets Chapters 5-6 Color and Background Controls Border and Margin Controls.
>> 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.
>> More on CSS Selectors. Pre-requisite Open the file called sample.txt Copy the all the text from the file Open your browser and go to codepen.io Paste.
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.
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.
CIS 228 The Internet 10/18/11 Grouping XHTML. CSS Selectors Rule: selector-group { property-declaration* } Selector-group: selector *, Selector: simple-selector.
Understanding CSS Cascading Style Sheets control the presentation of content in HTML pages Style Sheets separate formatting from the content –Styles defined.
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,
WebD Introduction to CSS By Manik Rastogi.
CSS.
Chapter 6 - Cascading Style Sheets™ (CSS)
Cascading Style Sheets Boxes
Cascading Style Sheets™ (CSS)
( Cascading style sheet )
CSS Layouts: Grouping Elements
Unit 3 - Review.
Creating Your Own Webpage
UNIT-II CSS.
Cascading Style Sheets (Layout)
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 Applications to XML 19-Sep-18.
Objectives Create a reset style sheet Explore page layout designs
6 Layout.
Cascading Style Sheets
The Internet 10/13/11 The Box Model
CSS Borders and Margins.
Second CSS Lecture Applications to XML
Box model, spacing, borders, backgrounds
Cascading Style Sheets
>> Dynamic CSS Selectors
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.
The Box Model.
Cascading Style sheet. What is CSS?  CSS stands for Cascading Style Sheets  Cascading: refers to the procedure that determines which style will apply.
CSS Boxes CS 1150 Fall 2016.
CS3220 Web and Internet Programming More CSS
CSS Applications to XML 20-May-19.
Web Client Side Technologies Raneem Qaddoura
CS3220 Web and Internet Programming More CSS
Web Programming and Design
CSS Applications to XML 3-Jul-19.
Cascading Style Sheets™ (CSS)
CS3220 Web and Internet Programming More CSS
Presentation transcript:

>> The “Box” Model

Pre-requisite Create a new html file and name it box.html Create a new css file and name it style.css Link the css file to the html file <link rel=“stylesheet” href=“style.css”/>

Recall Styling in CSS Static Styling Dynamic Styling Selectors Type or Element | ID | Class Combining Selectors using “,” Inheritance Selectors Descendants | Child | General Sibling | Adjacent Sibling Attribute Selectors Dynamic Styling Pseudo-class (:) Link Pseudo-class (link | visited | hover | active) Form Pseudo-class (hover | focus | required | valid | invalid) Pseudo-elements (::) first-letter | first-line

Types of Elements (display type) Block Inline Web-based Systems | Misbhauddin

Web-Based Systems - Misbhauddin The”BOX” Model CSS treats each element as a rectangular box Eg. <h1>Welcome</h1> Margin Area Border Area Padding Area Welcome Content Area Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin Border Every element has a border around it Border Properties border-width: <length> | thin | medium | thick border-color: <color> | transparent border-style: none | dotted | dashed | solid | double | groove | ridge | inset | outset Can combine border properties with the side Eg. border-top-style, border-bottom-color border-top border-left border-right border-bottom Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin TRY NOW Add an h1 element with “your name” Add a paragraph element with “Student at CCSIT-KFU” Edit CSS File Set the body tag to border {1px solid black} Set the h1 tag to border {1px solid red} Set the p tag to border {1px solid blue} Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin Padding Padding: Space between the content and the border Padding Properties padding: <length> | <percentage-box-width>% Separate paddings for each side padding Content of the Box box Content padding-top padding-left padding-right padding-bottom Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin TRY NOW Edit CSS File Add padding to your paragraph tag Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin Margin Margin: Space between the border and other elements Margin Properties margin: <length> | <percentage-box-width>% Separate Margin for each side margin Content border margin-top margin-left Content margin-right margin-bottom Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin TRY NOW Edit CSS File Increase or decrease the margin between the h1 tag and the p tag Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin Display Display Properties display: inline | block | none Element 1 Element 1 Element 2 Element 3 Element 2 {display: inline; } Element 3 Element 1 Element 3 {display: block; } Element2{display: none; } Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin Visibility Visibility Properties visibility: visible | hidden Element 1 Element 1 Element 2 Element 3 Element 3 {visibility: visible; } Element 2{visibility: hidden; } Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin TRY NOW Add an h2 tag between the h1 and the p tag Edit CSS File Change the display of h2 to “none” Change the visibility of h2 to “hidden” Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin Background Using a Color Property: background-color Using an Image Property: background-image Usage: background-image:url(‘myimage.png’); Using an Image – Repeat Use the background-image property again Use another property called background-repeat Values: repeat | repeat-x | repeat-y | no-repeat Using an Image – Position Use another property called background-position Values: top |bottom | center | left | right | center Can also add distance from the position in the same value Eg. background-position: 10px right; Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin Dimension Sets the height and width of an element width: <length> | <percentage-parent-width>% | auto height: <length> | <percentage-parent-width>% | auto overflow: hidden | visible | scroll | auto Can also use properties to restrict minimum and maximum dimensions min-width, min-height max-width, max-height This is a block of text. The main Intention behind this box is to Demonstrate the overflow property When it comes to displaying an Element inside a box Overflow Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin Shorthand Properties Backgrounds background: <background-color> <background-image> <background-repeat> <background-attachment> <background-position> Borders border: <border-width> <border-color> <border-style> Padding & Margins 1 value: used for all sides 2 values: <top/bottom> <left/right> 4 values: <top> <right> <bottom> <left> Note: If any value for a property is missing in the shorthand, the next one will be assumed Web-Based Systems - Misbhauddin

Next on Web-based Systems Cascading Style Sheets Layout in CSS Navigation in CSS