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

后端 未结 7 1928
面向向阳花
面向向阳花 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条回答
  •  萌比男神i
    2020-11-28 18:18

    Add property:

    -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
    -moz-box-sizing: border-box;    /* Firefox, other Gecko */
    box-sizing: border-box;         /* Opera/IE 8+ */
    

    Note: This won't work in Internet Explorer below version 8.

提交回复
热议问题