CSS3 box-sizing PropertiesThe Box-sizing property can be one of three values: Content-box (Default), Border-box,padding-box.Content-box,border and padding do not count into widthPadding-box,padding calculation into width insideBorder-box,border and padding calculation into the width, in fact, is a strange mode ~ie8+ Browser supports Content-box and Border-box;The FF supports all three values.When used:-webk
Box modelThe standard: the width of the definition of content, there are Padding,border will make the final rendering of the breadth of the definition of the sum of Width+padding+border, with margin plusIE Standard: The width defined for the inclusion of the border,padding, so that the final rendered widths are defined, with margin plusBox-sizing: Make the box appear in IE modeContent-sizing: Making the box
When using the PURECSS framework, a problem is encountered. Input box, I gave them width and padding values, I found that in Firefox and Google found that increasing the padding value does not affect the final width, and under IE6 7 will affect the width. It was later found that the pure framework set box-sizing for the input box (IE6 7 is not supported) and I have to set different widths respectively. Therefore, in the use of this framework, in order
Relationship between width and height and box-sizing: border-box and content-box, bordersizing
The content-box width and height of the default width and height.
Box-sizing is often usedSet the area specified by width and height
Box-sizing is often used for Adaptive Layout.
Syntax:
Box-sizing: Content-box | borde
Box-sizing
Properties
box-sizing property is used to change the way the default CSS box model calculates the width of the element. This property can be used to simulate the performance of browsers that do not correctly support the standard box model.
box-sizing:content-box (default) | Border-box;
content-box
Default value, standard box model. Width and height include only the width
This article introduces you to the article is about CSS in the use of border-sizing attributes, there is a good reference value, hope to help the needy friends.
The box-sizing is used to change the default CSS box model used to calculate the width and height of elements. It has three kinds of content-box, Border-box and inherit values. Inherit refers to inheriting box-s
This article describes the box-sizing attribute in CSS3, before which the reader needs to prepare the scope of the knowledge width.Browser Support Scenarios
Browser
suppored
Notes
Internet Explorer
Yes
Version 8.0
Mozilla Firefox
Yes
29.02.0-moz-
Chrome
Yes
10.04.0-webkit-
Opera
Yes
Version 9.5
Safari
This article describes the box-sizing attribute in CSS3, before which the reader needs to prepare the scope of the knowledge width.Browser Support Scenarios
Browser
suppored
Notes
Internet Explorer
Yes
Version 8.0
Mozilla Firefox
Yes
29.02.0-moz-
Chrome
Yes
10.04.0-webkit-
Opera
Yes
Version 9.5
Safari
box-sizingthe CSS3 property can be set to include padding (padding) and border (border) in the width and Height properties.The default CSSWidth is: width (width) + padding (padding) + border (border) = element actual widthHeight is: height (high) + padding (padding) + border (border) = element actual heightThis means that two div elements are the same size, but because setting padding or border also affects the size of the elements such as:{margin:0;padding:0}. Box1,. Box2{width:100px;Height:100
When you refactor the mobile end page, we often encounter two frames side-by-side situation, and need to be wide adaptive, equal width, have a border such a situation, my usual method is to use the positioning to deal with, and then use a negative positioning to solve, but later found that you can use the Box-sizing attribute in CSS3 to be done. All right, let's recommend it to everyone.
Grammar:
Box-sizing:content-boxborder-boxinherit;
De
* {-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;}Sometimes these css are found in some projects. What is the use of box-sizing still have to start talking about ...We generally calculate the width of a block element will be left and right padding, the left border width, margin is counted in, as shown (browser default calculation), width is not 100px, but 160px:Style= "width:100px;padding:15px;border:5px solid black;ma
Objective outlineI. Syntax declarationBox-sizing:content-box | Border-box | InheritTwo. Attribute Value descriptionContent-box the padding and border of the element drawn outside the width and height border-box any padding and borders specified for the element will be drawn within the set width and height inherit inherit the value of the Box-sizing property of the parent elementThree. Browser compatibilityDescription IE8 and above support this prop
---Restore content starts---
Box-sizing
Properties allow you to define specific elements that match a region in a specific way.
For example, if you need to place two boxes with borders side-by, you can set box-sizing to "Border-box". This allows the browser to render a box with the specified width and height, and place the border and padding into the box.
GrammarBox-sizing:content-box|border-box|inherit;
be more suitable for us to understandThe width and Height properties We set are the actual widths and heights of the elements.The calculation formula is as followselement content Area width = width-padding (left and right padding size)-border (left and right border size)element content Area height = height-padding (upper and lower padding size)-border (upper and lower border size)Under the box model in IE6 promiscuous modeAfter we set the width and heightThe width of the element is settled.Sett
Box-sizing, know why, see English, "box type". I'll go, all right. is how you want to get the box model.Come on, see what property values are available:Box-sizing:content-box|border-box|inherit;Well, three. Not bad(1) Content-box: The width and height are applied to the content box of the element respectively. draws the inner margin and border of the element outside the width and height.Understand, do not understand quickly to see the box model is wh
. Adding border, margin, padding causes the content width to decrease and the width of the reduction to be the sum of the three.2, the width of the box to add border, margin, padding, will lead to wider box expansion. The Width property of a box is just the breadth of the box's content area, not the horizontal width the box occupies.For ease of calculation, CSS3 new attribute box-sizing can also set the width of the box to No width (width= "auto") sta
Some time ago in an interface to encounter a problem, to a long width is 100% of the page div set border, the length of the div is more than 100%, this is how it happened? This is not a problem for the boss who is proficient in CSS, but for the first entry of me is a bit of a dumb, so find a lot of information to understand after the solution of this problem, here to share, to remind themselves of the importance of continuous learning.Look at the problem first, this is the comparison of the code
Reference: 1. W3cplus 2.MDNBox modelCSS in the box model is divided into two, the first is the standard model of the Internet, and the other is the traditional model of IE. It involves width, height, padding, border and margin.1, the Standard box Model: /*外盒尺寸计算(元素空间尺寸)*/ Element空间高度 = content height + padding + border + margin Element 空间宽度 = content width + padding + border + margin /*内盒尺寸计算(元素大小)*/ Element Height = content height + padding + border (Height为内容高度) Element Width = content w
The box-sizing property is used to define the area represented by the width and height of the element . This property generally has three kinds of values: Content-box, Border-box, inherit. Where inherit indicates that the value of box-sizing should inherit from the parent element.The main difference between Content-box and Border-box is that the value of the element's width and height package does not incl
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.