
- 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
Creating Layouts with Box-Sizing using CSS3
To create box-sizing layouts using CSS3, the code is as follows −
Example
<!DOCTYPE html> <html> <head> <style> body{ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } .container{ width: 500px; border:8px solid rgb(35, 0, 100); } .border { box-sizing: border-box; width: 100%; height: 100px; border: 4px solid rgb(4, 97, 54); } .content { width: 100%; height: 100px; padding: 50px; border: 4px solid rgb(255, 0, 191); box-sizing: content-box; } </style> </head> <body> <h1>Box sizing layout example</h1> <div class="container"> <div class="border">This div has 100% width and box-sizing property set to border box</div> <br> <div class="content">This div also has 100% width but has the box-sizing property set to content box</div> </div> </body> </html>
Output
The above code will produce the following output −
- Related Articles
- CSS3 Box Width with Box-Sizing
- CSS3 Flexible Box Layouts
- CSS2 sizing property vs CSS3 box sizing property
- CSS Box Sizing Property
- Text in Transparent Box using CSS3
- Creating CSS3 Radial Gradients
- Creating a prompt dialog box using Tkinter?
- Creating a popup message box with an Entry field in tkinter
- Moving left animation with keyframes using CSS3
- Creating a 3D Metal Texture Box in React using React-Three-Fiber
- How to create CSS3 Box and Text Shadow Effects?
- Transform the element using z-axis with CSS3
- Transform the element using x-axis with CSS3
- Transform the element using y-axis with CSS3
- Example of key frames with left animation using CSS3

Advertisements