【发布时间】:2016-09-09 07:43:16
【问题描述】:
仍在学习 CSS 的工作原理。目前,我正在尝试使背景图像覆盖整个标题,而顶部/右侧/左侧没有任何间隙。
我尝试了其他几个选项,但似乎无法移动此图像。
(即添加 html,但我想将其与该文件分开。我也有尝试制作边距 0)
<!--EXAMPLE1-->
.splash_img {
background-repeat:no-repeat;
background-position: center top;
display:block;
margin:0px auto;
}
<!--EXAMPLE2-->
.splash_img:{
background-image:url("Images/bakemock.jpg") no-repeat center;
background-size:100% 100%;
height:630px;
}
它继续停留在浏览器的右上角。目前这就是我所拥有的。
<head>
<div class="splash_img">
<img src="Images/bakemock.jpg" alt="bake"/>
</div>
</head>
.splash_img:{
background-image:url("Images/bakemock.jpg") no-repeat center;
background-size:100% 100%;
height:630px;
}
【问题讨论】:
-
你的意思是有
而不是 吗? -
我的意思是 这只是一个图像 - 不会有任何
等。标题
-
标签应该只包含关于页面的元数据,内容元素应该在 中。 之外的元素不会被渲染
标签: html css image header width