Face questions often test & compulsory - The box model and box-sizing (often used in the project)

Mainly on the value of the width, including padding \ border \ content and other attributes? ? ?

css3 box-sizing property is unique Oh ***

1 "When the Box-Sizing: Content-Box ; when, with css2 property is the same as before. (That is, add this sentence, and I did not write this sentence effect is the same)

Code:

 Element width:

 

 

 The width of the elements is: 200 + 10 * 2 + 15 * 2 = 250

2 "When the box-sizing: border-box; when, please pay attention to myself

Code:

 

 Element width:

 

 

  The width of the elements is: 150 + 10 * 2 + 15 * 2 = 200

 

Guess you like

Origin www.cnblogs.com/snowbxb/p/11532789.html