仍在学习 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;
}
Run Code Online (Sandbox Code Playgroud)
它继续停留在浏览器的右上角。目前这就是我所拥有的。
<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;
}
Run Code Online (Sandbox Code Playgroud)