How do I prevent the padding property from changing width or height in CSS?

后端 未结 7 1934
面向向阳花
面向向阳花 2020-11-28 17:52

I am creating a site with DIVs. Everything\'s working out except when I create a DIV. I create them like this (example):

newdiv {
    width: 200         


        
相关标签:
7条回答
  • 2020-11-28 18:28

    just change your div width to 160px if you have a padding of 20px it adds 40px extra to the width of your div so you need to subtract 40px from the width in order to keep your div looking normal and not distorted with extra width on it and your text all messed up.

    0 讨论(0)
提交回复
热议问题