html - 样式标题:从 W3.CSS 中删除边距
问题描述
.main_header
{
background: tomato;
height: 250px;
width:100%;
margin:0 !important;
padding:0 !important;
}
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<div style="padding:0 !important; margin:0 !important;" class="w3-container w3-red">
<p>test</p>
</div>
<div class ="main_header">
<p> test_2</p>
</div>
在尝试在 a 的中间添加一个带 definedpage.aspx
的部分时,我使用了 2 种方法:header
background-color
1.:
a - 在母版页中添加:
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
b- 在目标中使用page.aspx
:
<div style="padding:0 !important; margin:0 !important;" class="w3-container w3-red">
<p>test</p>
</div>
2.:
c - 在母版页中定义:
<style type="text/css">
....
.main_header
{
background: tomato;
height: 250px;
width:100%;
margin:0 !important;
padding:0 !important;
}
</style>
d- 然后在目标中使用page.aspx
:
<div class ="main_header"></div>
==> 两种方法(1 和 2)产生相同的结果:条形/标题部分出现在页面的中心。但是,我希望两者都left/right-margins
被删除,以便使栏/标题部分显示在整个网页上,就像fixed Navbar
.
注意:请注意,申请style sheet
没有帮助:
html, body{
margin:0 !important;
padding:0 !important;
}
因此,任何解释/想法都将受到高度赞赏。
解决方案
推荐阅读
- arrays - 减小 MATLAB 变量的文件大小
- printing - Xamarin Forms 需要帮助才能通过蓝牙打印机 XP200 进行打印
- .net - Wonderware 系统平台。如何从远程 PC 获取 DateTime?
- vba - 从 VBA 连接到 power bi 并导出大量数据
- c++ - 从“int”到“Vector*”的无效转换
- c# - 当我尝试达到 Rectangle 时的 Null 值
- javascript - 如何在单击时订购颜色下拉数据将移动到我使用 jquery 放置的部分?
- url - 为什么用“?” 而不是 URL 中的“:”?
- java - 使用 Spring Boot 2.0 的 Swagger 导致 404 错误页面
- c# - 只允许是或否作为答案