<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 8 年前。
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 8 年前。
我正在尝试使用内联方法重置 CSS。我也尝试使用 body 标签和 maincontainer 类上的样式来重置 CSS。但是,我无法进行重置。 谁能告诉我如何在内联方法中重置 CSS?
在嵌入方式中,我可以将 CSS 重置为
*{
margin: 0 auto;
padding: 0 auto;
}
但是,当我尝试内联时无法获得相同的结果。
最佳答案
您可以通过为每个元素添加边距和填充来轻松地进行测试。所以如果你有一个简单的页面,假设只有一个 div,你必须像这样将它添加到所有标签中
<html style="margin: 0 auto; padding: 0 auto;">
<body style="margin: 0 auto; padding: 0 auto;">
<div style="margin: 0 auto; padding: 0 auto;">
所以这个方法重复性很强。我不确定您为什么要这样做,但可能是有原因的。
关于html - 如何以内联方式重置 CSS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27367817/