Answer the question
In order to leave comments, you need to log in
How to calculate the width according to the available codes?
It is not possible to correctly calculate the width by the code:
span
{
display: block;
width: 120px;
padding: 10px 15 px 20px 25px;
border: 1px solid#00000
}
display: block
display
inline
Answer the question
In order to leave comments, you need to log in
Look at the box-sizing property
By default, the width of a box in the browser is the sum of width, padding, and border.
120 + 15 + 25 + 1 + 1 = 162
If you specify box-sizing:border-box
, then the final width will be determined by the width property
I am also interested in how other display properties can affect and can, for example: inline?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question