上面是我项目的标题,但是填充是自动添加的。我尝试在应用程序文件夹外部的styles.css中将padding更改为0:
/* You can add global styles to this file, and also import other style files */
body {
margin: 0;
padding: 0;
}
我的appcomponent.html看起来像这样:
<app-header></app-header>
<router-outlet></router-outlet>
<app-footer></app-footer>
我也尝试过将padding 0添加到headercomponent.css:
.body {
background-color: pink;
padding-top: 0px;
}
Headercomponent.html是:
<div class="body">
<h1 class="text-center">
Crypcheck
</h1>
<p class="text-center">
Check prices of your favourite cryptocurrencies!
</p>
</div>
谢谢阅读。
如果您使用Chrome DevTools或浏览器中的同等工具检查元素,您将能够看到应用的样式以及样式的来源。右键单击您的组件,然后选择检查。
作为下面的屏幕快照的示例,您可以看到tools.css
浏览器中的边距如何覆盖默认样式(用户代理样式表)。
如果更改选定的元素,则可以找出空白的来源。
来源:检查和编辑页面和样式
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句