我是angular框架的新手,TypeScript和我在创建一个简单的页面时遇到了这个问题。
我想给页面一个完整的图像背景,但是背景图像只会出现在HTML标记的子元素(参见图片)后面。所以经过多次尝试和失败之后,我试着做同样的事情,但是在一个在线的html,css编辑器中(见代码片段)。这个编辑给出了预期的和想要的结果?我是在html上方缺少了一个DOM元素,还是angular 4框架添加了另一个根?
html {
background: url(http://www.apicius.es/wp-content/uploads/2012/07/IMG-20120714-009211.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}<html>
<body>
<div>
<h1>Title</h1>
<h3>Subtitle</h3>
</div>
</body>
</html>
发布于 2017-10-13 21:27:55
您可以在应用程序条目周围的div中添加一个类。
index.html
<style>
.bg{
width: 100%;
height: 100%;
background: url('your-url') no-repeat center;
background-size: 100% 100%;
background-position: top center;
}
</style>
...
<div class="bg">
<app>
Loading...
</app>
</div>https://stackoverflow.com/questions/46730606
复制相似问题