- CSS - Scrollbars
- CSS - Dimension
- CSS - Outlines
- CSS - Cursors
- CSS - Padding
- CSS - Lists
- CSS - Margins
- CSS - Borders
- CSS - Tables
- CSS - Links
- CSS - Images
- CSS - Text
- CSS - Fonts
- CSS - Backgrounds
- CSS - Colors
- CSS - Measurement Units
- CSS - Inclusion
- CSS - Syntax
- CSS - Introduction
- CSS - Home
CSS Advanced
- CSS - Validations
- CSS - Layouts
- CSS - Printing
- CSS - Aural Media
- CSS - Paged Media
- CSS - Media Types
- CSS - Text Effects
- CSS - @ Rules
- CSS - Pseudo Elements
- CSS - Pseudo Classes
- CSS - Layers
- CSS - Positioning
- CSS - Visibility
CSS3 Tutorial
- CSS3 - Box Sizing
- CSS3 - User Interface
- CSS3 - Multi columns
- CSS3 - Animation
- CSS3 - 3d transform
- CSS3 - 2d transform
- CSS3 - Web font
- CSS3 - Text
- CSS3 - Shadow
- CSS3 - Gradients
- CSS3 - Color
- CSS3 - Multi Background
- CSS3 - Border Images
- CSS3 - Rounded Corner
- CSS3 - Tutorial
CSS Responsive
CSS References
- CSS - Animation
- CSS - Units
- CSS - Web safe fonts
- CSS - Web browser References
- CSS - Color References
- CSS - References
- CSS - Quick Guide
- CSS - Questions and Answers
CSS tools
CSS Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
CSS3 - Box Sizing
Box sizing property is using to change the height and width of element.
Since css2, the box property has worked pke 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
Means when you set the height and width, it appears pttle bit bigger then given size cause element boarder and padding added to the element height and width.
CSS2 sizing property
<html> <head> <style> .span1 { width: 200px; height: 100px; border: 1px sopd green; } .span2 { width: 200px; height: 100px; padding: 50px; border: 1px sopd pink; } </style> </head> <body> <span class = "span1">TutorialsPoint.com</span><br /> <span class = "span2">TutorialsPoint.com</span> </body> </html>
It will produce the following result −
Above image is having same width and height of two element but giving result is different, cause second one is included padding property.
CSS3 box sizing property
<html> <head> <style> .span1 { width: 300px; height: 100px; border: 1px sopd blue; box-sizing: border-box; } .span2 { width: 300px; height: 100px; padding: 50px; border: 1px sopd red; box-sizing: border-box; } </style> </head> <body> <span class = "span1">TutorialsPoint.com</span><br /> <span class = "span2">TutorialsPoint.com</span> </body> </html>
Above sample is having same height and width with box-sizing:border-box. here result is shown below.
It will produce the following result −
Above elements are having same height and width with box-sizing:border-box so result is always same for both elements as shown above.
Advertisements