所以基本上我是在尝试将我的 Div 400px 中的项目向右移动。我已经在源 html 中添加了“padding-left:400px”,但是每次我运行代码时,就像你在图片中看到的那样,它会回到 42px,当我将 inspect 元素中的数字更改为 400 时,它看起来正常,有什么理由这样做吗?
这是我的 div 代码片段:
<div class="content" style="border-bottom-width: 300px;margin-bottom: 0px;height: 430px !important;">
<div class="footer-grids" style="
width: 1500px;
padding-left: 400px;
margin-top: 100px;
最佳答案
您的代码没有问题,您缺少关闭的 div,您需要检查关闭的 div 是否正确尝试使用下面的代码片段,只需检查一下
<div class="content" style="border-bottom-width: 300px;margin-bottom: 0px;height: 430px !important;">
<div class="footer-grids" style="width: 1500px;padding-left: 400px;margin-top: 100px;"></div>
</div>
截图在这里
关于html - Div填充不遵循html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42060751/