Click here to Skip to main content
15,789,698 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
div {
width: 10px;
padding-left: 5px;
padding-right: 5px;
margin-left: 5px;
margin-right: 5px;

What I have tried:

i hate for calculating the values of pixels
Updated 2-Jun-23 20:13pm

1 solution

The margin-box width = content width + padding width + border width + margin width. In this scenario, the margin-box width is 30 pixels.

So, if you calculate margin-box width is 10px.
Margin-left is (2*5)=10px
Margin-right is (2*5)=10px

Finally it will be 30px
Share this answer
Richard Deeming 5-Jun-23 4:25am    
Posting a question to which you already know the answer, just so that you can immediately post the answer, is considered an abuse of the site. Keep it up, and you will be banned.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900