Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 将图片固定在横幅上_Html_Css - Fatal编程技术网

Html 将图片固定在横幅上

Html 将图片固定在横幅上,html,css,Html,Css,!![飞机][1] #top { background-color:maroon; width:100%; height:110px; background-image:url(im.jpg); background-repeat:no-repeat; } 我想把这幅画固定在横幅上。但我不知道如何实现这一点。图像存储在哪里?尝试使用完整路径。请提供小提琴。尝试设置背景大小:100%自动,如果要查看背景颜色,则img应透明。仅当图像与网页位于同一位置时,此

!![飞机][1]

#top
{
    background-color:maroon;
    width:100%;
    height:110px;
    background-image:url(im.jpg);
    background-repeat:no-repeat;
}

我想把这幅画固定在横幅上。但我不知道如何实现这一点。

图像存储在哪里?尝试使用完整路径。请提供小提琴。尝试设置背景大小:100%自动,如果要查看背景颜色,则img应透明。仅当图像与网页位于同一位置时,此选项才有效。如果它位于子目录中,则需要指定路径。是。您必须指定完整路径。
<!doctype html>
<html>
<head>
<style>
       #sample{
    background-color:maroon;
    width:100%;
    height:110px;
    background-image:url(im.jpg);
    background-size: 100% 110px;
    background-repeat:no-repeat;
}

</style>
</head>
<body>
<div id='sample'></div>
</body>
</html>