
- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursors
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS Advanced
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Media Types
- CSS - Paged Media
- CSS - Aural Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS3 - Rounded Corner
- CSS3 - Border Images
- CSS3 - Multi Background
- CSS3 - Color
- CSS3 - Gradients
- CSS3 - Shadow
- CSS3 - Text
- CSS3 - Web font
- CSS3 - 2d transform
- CSS3 - 3d transform
- CSS3 - Animation
- CSS3 - Multi columns
- CSS3 - User Interface
- CSS3 - Box Sizing
- CSS Responsive
- CSS - Responsive Web Design
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
CSS Box Sizing Property
Box-sizing property is used to change the height and width of the element. Since CSS2, the box property has worked like as shown below −
width + padding + border = actual visible/rendered width of an element's box height + padding + border = actual visible/rendered height of an element's box
Example
To understand the box-sizing property, let us see an example:
<html> <head> <style> .div1 { width: 300px; height: 100px; border: 1px solid blue; box-sizing: border-box; } .div2 { width: 300px; height: 100px; padding: 50px; border: 1px solid red; box-sizing: border-box; } </style> </head> <body> <div class = "div1">TutorialsPoint.com</div></br> <div class = "div2">TutorialsPoint.com</div> </body> </html>
- Related Articles
- CSS2 sizing property vs CSS3 box sizing property
- CSS3 Box Width with Box-Sizing
- How to use font-optical-sizing property in CSS?
- Animate box-shadow CSS property
- Creating Layouts with Box-Sizing using CSS3
- CSS Box Shadow
- CSS padding-box Value
- CSS content-box Value
- CSS border-box Value
- Understanding CSS Box Model
- Sizing Bootstrap pagination-* class
- Difference between -webkit-box-shadow & box-shadow in CSS
- Define the CSS Box Model
- Role of size property in CSS to set the size and orientation of a page box
- Create a transparent box with CSS

Advertisements