BOX DIMENSIONS width, height div { height: 300px; width: 400px; background-color: #ee3e80;} p { height: 75%; width: 75%; background-color:

Slides:



Advertisements
Similar presentations
Web Engineering 1 Ishaq Khan Shinwari MCS City University Peshawar.
Advertisements

Chapter 6 More CSS Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
CSS level 3. History of CSS CSS level 1 – original CSS CSS level 2 CSS level 2 Revision 1 (CSS2.1) – up to CSS2.1 monolithic structure CSS level 3 – specification.
Client-Side Internet and Web Programming
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.
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.
An Introduction to Cascading Style Sheets CSS Layout, and the CSS Box Model Nick Foxall SM5312 week 9: CSS Layout.
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}
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 Border.
LITTLE BOXES Controlling size of boxes Box model for borders, margin and padding Displaying and hiding boxes.
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.
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.
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,
WebD Introduction to CSS By Manik Rastogi.
CSS.
Laying out Elements with CSS
Cascading Style Sheets Boxes
Cascading Style Sheets™ (CSS)
( Cascading style sheet )
Semester - Review.
Google fonts CSS box model
CSS Layouts: Grouping Elements
Unit 3 - Review.
UNIT-II CSS.
>> The “Box” Model
Creating Page Layouts with CSS
Cascading Style Sheets (Formatting)
Box model.
CSS3 Cascading Style Sheet
Web Systems & Technologies
CSS Applications to XML 19-Sep-18.
Chapter 6 More CSS Basics Key Concepts
Objectives Create a reset style sheet Explore page layout designs
Cascading Style Sheets
Basics of Web Design Chapter 6 More CSS Basics Key Concepts
CSS Borders and Margins.
CSS Box Model.
Second CSS Lecture Applications to XML
HTML5 Level I Session III
HTML5 Level I Session III
Box model, spacing, borders, backgrounds
Basics of Web Design Chapter 6 More CSS Basics Key Concepts
Basics of Web Design Chapter 6 More CSS Basics Key Concepts
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 and Class Tools.
CSS Boxes CS 1150 Fall 2016.
CS3220 Web and Internet Programming More CSS
CSS Applications to XML 20-May-19.
CS3220 Web and Internet Programming More CSS
CSc 337 Lecture 5: Grid layout.
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:

BOX DIMENSIONS width, height div { height: 300px; width: 400px; background-color: #ee3e80;} p { height: 75%; width: 75%; background-color: #e1ddda;}

LIMITING WIDTH min-width, max-width td.description { min-width: 450px; max-width: 650px; text-align: left; padding: 5px; margin: 0px;} Note: need to expand and contract browser to demonstrate this

min-height, max-height LIMITING HEIGHT min-height, max-height h2, p { width: 400px; font-size: 90%; line-height: 1.2em;} h2 { color: #0088dd; border-bottom: 1px solid #0088dd;} p { min-height: 10px; max-height: 30px;} Note: need to expand and contract browser to demonstrate this

OVERFLOWING CONTENT overflow p.one { overflow: hidden;} p.two { overflow: scroll;} Explain: important when risk of overlapping elements (esp. when do not know amount of content in given element) Note: need to expand and contract browser to demonstrate this

BORDER, MARGIN & PADDING Click: border Click: margin Click: padding

WHITE SPACE & VERTICAL MARGIN Moog Moog synthesizers were created by Dr. Robert Moog under the company name Moog Music. Popular models include Moog Modular, Minimoog, Micromoog, Moog Rogue, and Moog Source Moog Moog synthesizers were created by Dr. Robert Moog under the company name Moog Music. Popular models include Moog Modular, Minimoog, Micromoog, Moog Rogue, and Moog Source Arp ARP Instruments Inc. was set up by Alan Peralman, and was the main competitor for Moog during the 1970's. Popular models include the Arp 2600 and the ARP Odyssey. Arp ARP Instruments Inc. was set up by Alan Peralman, and was the main competitor for Moog during the 1970's. Popular models include the Arp 2600 and the ARP Odyssey. Fade in: three paragraphs Explain: vertical margins collapse Click: three more paragraphs Explain: whitespace helps make more readable and attractive Sequential Circuits Sequential Circuits Inc was founded by Dave Smith, and the company was pivotal in the creation of MIDI. Famous models include the Prophet 5, Prophet 600, and Pro-One. Sequential Circuits Sequential Circuits Inc was founded by Dave Smith, and the company was pivotal in the creation of MIDI. Famous models include the Prophet 5, Prophet 600, and Pro-One.

BORDER WIDTH border-width p.one { border-width: 2px;} p.two { border-width: thick;} p.three { border-width: 1px 4px 12px 4px;} Possible keywords: thin, medium, thick Cannot use percentages Note: can specify separate values with border-top-width border-right-width border-bottom-width border-left-width

BORDER STYLE border-style p.one {border-style: solid;} p.two {border-style: dotted;} p.three {border-style: dashed;} p.four {border-style: double;} p.five {border-style: groove;} p.six {border-style: ridge;} p.seven {border-style: inset;} p.eight {border-style: outset;} Note: can specify separate values with border-top-style border-right-style border-bottom-style border-left-style

BORDER COLOR border-color p.one { border-color: #0088dd;} p.two { border-color: #bbbbaa #111111 #ee3e80 #0088dd;} Note: can specify separate values with border-top-color border-right-color border-bottom-color border-left-color

BORDER SHORTHAND border p { width: 250px; border: 3px dotted #0088dd;}

BORDER SHORTHAND border p { width: 250px; border: 3px dotted #0088dd;}

BORDER SHORTHAND border p { width: 250px; border: 3px dotted #0088dd;}

BORDER SHORTHAND border p { width: 250px; border: 3px dotted #0088dd;}

PADDING padding p { width: 275px; border: 2px solid #0088dd;} p.example { padding: 10px;} Note: can specify individual values using padding-top padding-right padding-bottom padding-left

PADDING padding p { width: 275px; border: 2px solid #0088dd;} p.example { padding: 10px;} Note: can specify individual values using padding-top padding-right padding-bottom padding-left

MARGIN margin p { width: 200px; border: 2px solid #0088dd; padding: 10px;} p.example { margin: 20px;} Explain: Vertical margins collapse Note: can specify individual values using margin-top margin-right margin-bottom margin-left

MARGIN margin p { width: 200px; border: 2px solid #0088dd; padding: 10px;} p.example { margin: 20px;} Explain: Vertical margins collapse Note: can specify individual values using margin-top margin-right margin-bottom margin-left

CENTERING CONTENT body { text-align: center;} p { width: 300px; padding: 50px; border: 20px solid #0088dd;} p.example { margin: 10px auto 10px auto; text-align: left;}

CENTERING CONTENT body { text-align: center;} p { width: 300px; padding: 50px; border: 20px solid #0088dd;} p.example { margin: 10px auto 10px auto; text-align: left;}

CENTERING CONTENT body { text-align: center;} p { width: 300px; padding: 50px; border: 20px solid #0088dd;} p.example { margin: 10px auto 10px auto; text-align: left;} Note: Auto values for left and right margins

CENTERING CONTENT body { text-align: center;} p { width: 300px; padding: 50px; border: 20px solid #0088dd;} p.example { margin: 10px auto 10px auto; text-align: left;}

IE6 BOX MODEL Analog synthesizers are often said to have a "warmer" sound than their digital counterparts. Width and padding are doubled unless you use a DOCTYPE declaration for HTML5, HTML4 strict, or HTML4 transitional Click: shows border of box Click: shows IE6 border of box Analog synthesizers are often said to have a "warmer" sound than their digital counterparts.

IE6 BOX MODEL Analog synthesizers are often said to have a "warmer" sound than their digital counterparts. Width and padding are doubled unless you use a DOCTYPE declaration for HTML5, HTML4 strict, or HTML4 transitional Click: shows border of box Click: shows IE6 border of box Analog synthesizers are often said to have a "warmer" sound than their digital counterparts.

CHANGE INLINE / BLOCK display li { display: inline; margin-right: 10px;} li.coming-soon { display: none;}

CHANGE INLINE / BLOCK display li { display: inline; margin-right: 10px;} li.coming-soon { display: none;} Possible values: inline, block, inline-block, none

HIDING BOXES visibility li { display: inline; margin-right: 10px;} li.coming-soon { visibility: hidden;}

HIDING BOXES visibility li { display: inline; margin-right: 10px;} li.coming-soon { visibility: hidden;} Explain: leaves space box would take up otherwise (unlike display:none) Possible values: hidden / visible

CSS3: BORDER IMAGES border-image p.one { -moz-border-image: url("dots.gif") 11 11 11 11 stretch; -webkit-border-image: url("dots.gif") 11 11 11 11 stretch; border-image: url("dots.gif") 11 11 11 11 stretch;} p.two { border-image: url("images/dots.gif") 11 11 11 11 round;} Note: The box must also have a border width for the image to be shown Explain: Different browser-specific implementations for max compatibility

CSS3: BORDER IMAGES border-image p.one { -moz-border-image: url("dots.gif") 11 11 11 11 stretch; -webkit-border-image: url("dots.gif") 11 11 11 11 stretch; border-image: url("dots.gif") 11 11 11 11 stretch;} p.two { border-image: url("images/dots.gif") 11 11 11 11 round;} The URL of the image

CSS3: BORDER IMAGES border-image p.one { -moz-border-image: url("dots.gif") 11 11 11 11 stretch; -webkit-border-image: url("dots.gif") 11 11 11 11 stretch; border-image: url("dots.gif") 11 11 11 11 stretch;} p.two { border-image: url("images/dots.gif") 11 11 11 11 round;} Where to slice the image

CSS3: BORDER IMAGES border-image p.one { -moz-border-image: url("dots.gif") 11 11 11 11 stretch; -webkit-border-image: url("dots.gif") 11 11 11 11 stretch; border-image: url("dots.gif") 11 11 11 11 stretch;} p.two { border-image: url("images/dots.gif") 11 11 11 11 round;} What to do with the straight edges; the possible values are:stretch - stretches the image repeat - repeats the image round - like repeat but if the tiles do not fit exactly, scales the tile image so they will

CSS3: BOX SHADOWS box-shadow p.one { -moz-box-shadow: -5px -5px #777777; -webkit-box-shadow: -5px -5px #777777; box-shadow: -5px -5px #777777;} p.two { box-shadow: 5px 5px 5px #777777;} p.three { box-shadow: 5px 5px 5px 5px #777777;} p.four { box-shadow: 0 0 10px #777777;} p.five { box-shadow: inset 0 0 10px #777777;} Explain: first example shows vendor prefix versions for max compatibility Up to 4 values: Horizontal offset Vertical offset Blur Distance Spread of Shadow

CSS3: BOX SHADOWS box-shadow p.one { -moz-box-shadow: -5px -5px #777777; -webkit-box-shadow: -5px -5px #777777; box-shadow: -5px -5px #777777;} p.two { box-shadow: 5px 5px 5px #777777;} p.three { box-shadow: 5px 5px 5px 5px #777777;} p.four { box-shadow: 0 0 10px #777777;} p.five { box-shadow: inset 0 0 10px #777777;}

CSS3: BOX SHADOWS box-shadow p.one { -moz-box-shadow: -5px -5px #777777; -webkit-box-shadow: -5px -5px #777777; box-shadow: -5px -5px #777777;} p.two { box-shadow: 5px 5px 5px #777777;} p.three { box-shadow: 5px 5px 5px 5px #777777;} p.four { box-shadow: 0 0 10px #777777;} p.five { box-shadow: inset 0 0 10px #777777;}

CSS3: BOX SHADOWS box-shadow p.one { -moz-box-shadow: -5px -5px #777777; -webkit-box-shadow: -5px -5px #777777; box-shadow: -5px -5px #777777;} p.two { box-shadow: 5px 5px 5px #777777;} p.three { box-shadow: 5px 5px 5px 5px #777777;} p.four { box-shadow: 0 0 10px #777777;} p.five { box-shadow: inset 0 0 10px #777777;}

CSS3: BOX SHADOWS box-shadow p.one { -moz-box-shadow: -5px -5px #777777; -webkit-box-shadow: -5px -5px #777777; box-shadow: -5px -5px #777777;} p.two { box-shadow: 5px 5px 5px #777777;} p.three { box-shadow: 5px 5px 5px 5px #777777;} p.four { box-shadow: 0 0 10px #777777;} p.five { box-shadow: inset 0 0 10px #777777;}

CSS3: ROUNDED CORNERS border-radius p { border: 5px solid #ee3e80; padding: 20px; width: 275px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px;}

CSS3: ROUNDED CORNERS border-radius p { border: 5px solid #ee3e80; padding: 20px; width: 275px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px;} Note: vendor prefixes for max compatibility

CSS3: ELLIPTICAL SHAPES border-radius p.one { border-radius-top-left: 80px 50px;} p.two { border-radius: 1em 4em 1em 4em / 2em 1em 2em 1em;} p.three { padding: 0px; border-radius: 100px;} Note: No vendor prefixes shown here

CSS3: ELLIPTICAL SHAPES border-radius p.one { border-radius-top-left: 80px 50px;} p.two { border-radius: 1em 4em 1em 4em / 2em 1em 2em 1em;} p.three { padding: 0px; border-radius: 100px;} Individual corner styling

CSS3: ELLIPTICAL SHAPES border-radius p.one { border-radius-top-left: 80px 50px;} p.two { border-radius: 1em 4em 1em 4em / 2em 1em 2em 1em;} p.three { padding: 0px; border-radius: 100px;} Individual horizontal values to create ellipses

CSS3: ELLIPTICAL SHAPES border-radius p.one { border-radius-top-left: 80px 50px;} p.two { border-radius: 1em 4em 1em 4em / 2em 1em 2em 1em;} p.three { padding: 0px; border-radius: 100px;} Individual vertical values to create ellipses

CSS treats each HTML element as if it has its own box. SUMMARY CSS treats each HTML element as if it has its own box. Clicks: Load individual bullets

You can use CSS to control the dimensions of a box. SUMMARY You can use CSS to control the dimensions of a box. Clicks: Load individual bullets

You can also control the borders, margins and padding for each box SUMMARY You can also control the borders, margins and padding for each box with CSS. Clicks: Load individual bullets

SUMMARY It is possible to hide elements using the display and visibility properties. Clicks: Load individual bullets

SUMMARY Block-level boxes can be made into inline boxes, and inline boxes made into block-level boxes. Clicks: Load individual bullets

SUMMARY Legibility can be improved by controlling the width of boxes containing text and the leading. Clicks: Load individual bullets

the ability to create image borders and rounded borders. SUMMARY CSS3 has introduced the ability to create image borders and rounded borders. Clicks: Load individual bullets