Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.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 如何将背景图像添加到具有自动扩展高度的div底部_Html_Css - Fatal编程技术网

Html 如何将背景图像添加到具有自动扩展高度的div底部

Html 如何将背景图像添加到具有自动扩展高度的div底部,html,css,Html,Css,我有一个侧面div,它包含一个垂直导航ul,每个页面上都有不同数量的内容 基本上,我想在div的底部添加一个图像,我希望它能够根据包含的内容量自动展开 我该怎么做 谢谢假设您可以将此图像设置为背景,则可以查看背景位置 例如: background-position: center bottom; 您可以在导航div中放置一个包含图像的div,以便图像始终位于div的底部,然后应用此css .navImg{ width: 100%; positio

我有一个侧面div,它包含一个垂直导航ul,每个页面上都有不同数量的内容

基本上,我想在div的底部添加一个图像,我希望它能够根据包含的内容量自动展开

我该怎么做


谢谢

假设您可以将此图像设置为背景,则可以查看背景位置

例如:

background-position: center bottom;

您可以在导航div中放置一个包含图像的div,以便图像始终位于div的底部,然后应用此css

  .navImg{
      width: 100%;          
      position: absolute;          
      top: 0;
      left: 0;  }


<div id="navigation">
  //navigation ul
<div class="navImg"></div>
</div>
.navImg{
宽度:100%;
位置:绝对位置;
排名:0;
左:0;}
//导航ul

您能否澄清“自动展开”,如果它将填充100%的高度,为什么您指定它必须位于div的底部?我想你的意思是它将从底部向上扩展?它不应该是
bottom:0而不是
top
#menu
{
  float:left;
  width:50px;
  border:1px solid black;
  padding:10px;
  background:black url(http://tinyurl.com/3brzfja) repeat-x center bottom;
}