• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Box Model
 

Box Model

on

  • 3,206 views

slide on box model,boroken box model and box model hacks

slide on box model,boroken box model and box model hacks

Statistics

Views

Total Views
3,206
Views on SlideShare
3,197
Embed Views
9

Actions

Likes
1
Downloads
37
Comments
0

3 Embeds 9

http://www.slideshare.net 5
http://www.linkedin.com 3
https://online.fvtc.edu 1

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Box Model Box Model Presentation Transcript

    • Box Model By : Payel Ghosh Mail : g.payel@ puneitlabs.com
    • What is the box model
      • Box model defines contents inside an HTML element as being surrounded by an invisible rectangular box, surrounding this box are three rectangular belts, represented by the margin, border, and padding properties.
      • Describing box model is the manipulation of a block-level element through:
      • Margin
      • Border
      • Padding
      • Height
      • Width
    • The box model in context
    • CSS Box Model : Margins
      • margin
      • Values: [ <length> | <percentage> | auto ]{1,4} |
      • Initial value: Not defined
      • Applies to: All elements
      • Inherited: No
      • Percentages: Refer to the width of the containing block
      • Computed value: See individual properties
      • Margin properties : margin-top, margin-right, margin-bottom,
      • margin-left, margin;
      • example:
      • BODY { margin: 2px } /* all margins set to 2px */
      • BODY { margin: 1px 2px } /* top & bottom = 1px, right & left = 2px */
      • BODY { margin: 1px 2px 3px } /* top=1px, right=2px, bottom=3px, left=2px */
    • CSS Box Model : Padding
      • padding
      • Values: [ <length> | <percentage> ] {1,4}
      • Initial value: Not defined for shorthand elements
      • Applies to: All elements
      • Inherited: No
      • Percentages: Refer to the width of the containing block
      • Computed value: See individual properties (padding-top, etc.)
      • Note: Padding should never be negative
    • CSS Box Model : Border
      • Border :
      • Values: [ none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset ]{1,4} |
      • Initial value: Not defined for shorthand properties
      • Applies to: All elements
      • Inherited: No
    • The broken Box Model
      • Broken layouts
      • The broken box model occurs in internet explorer
      • Widths of block-level elements ( div, p, h1 etc) will be different to other browsers like Mozilla, Opera, Safari
      • Your layout may work in one browser , but be broken in another
    • Calculating the Box Model
      • Web Standards Calculation
        • Width deals with content only. Padding and border and margin are set in addition to the width.
        • Box of 100px with padding: 10px; border: 10px
          • need a width: 100px;
      • IE 5 (all modes) IE 6/7 quirks mode
        • Width deals with entire box model. Padding, and border are contained within the width.
        • Box of 100px with padding: 10px; border: 10px
          • need a width: 140px;
    • Affects on layouts
      • Internet explorer – the culprit
      • Calculates widths and heights differently
      • IE 5/6/7 are affected
      • Quirks mode
      • IE 6 and 7 will revert if you do not specify a DOCTYPE
      • DOCTYPE needs to be first line in HTML document
      • IE still reverts even after mentioning DOCTYPE
    • Avoidance Tactics
      • Box model problems can be avoided by:
      • staying aware of the problems and fixes
      • Cross-browser testing
      • some tricks
      • Not to apply margin or padding to a div in order to create space in a layout.
      • Apply margins or padding to the elements inside the div
    • The Box Model Hacks
      • Box-in-box
      • The Tantek Hack
      • Simplified Box Model Hack (SBMH)
      • A modified SBMH
      • Alternate Box Model Hack
      • advantages and disadvantages
      • Follow the link :
      • http://css-discuss.incutio.com/?page=BoxModelHack