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 如何在侧栏包装css类中显示图像_Html_Css - Fatal编程技术网

Html 如何在侧栏包装css类中显示图像

Html 如何在侧栏包装css类中显示图像,html,css,Html,Css,我想在#边栏包装类中显示图像,我使用以下代码: CSS: HTML: 未显示图像。任何帮助或参考都将不胜感激 关于尝试使用此功能,它应该可以正常工作: #sidebar-wrapper { background:url(/images/nav.jpg) no-repeat center; // an maybe the quotes are not necessary. Check if the path is correct!

我想在#边栏包装类中显示图像,我使用以下代码:

CSS:

HTML:


未显示图像。任何帮助或参考都将不胜感激


关于

尝试使用此功能,它应该可以正常工作:

#sidebar-wrapper {
  background:url(/images/nav.jpg) no-repeat center; //  an maybe the quotes are not necessary. Check if the path is correct!
  background-size: cover; //  change this to 'contain' if you want to test different modes
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  margin-left: -250px;
  left: 250px;
  width: 250px;
  position: fixed;
  height: 100%;
  overflow-y: auto;
  z-index: 1000;
  transition: all 0.4s ease 0s;
}

你能给我们看看你的HTML或者制作一个演示吗<代码>位置:固定固定相对于屏幕的位置-如果滚动页面,元素将保持在屏幕上的相同位置。我想这可能是造成问题的原因。你能展示一下你的代码吗?你的代码工作得很好。很抱歉它不起作用了。当我检查元素“background image”属性时不可见。@MianOmerZia抱歉,我犯了一个小错误,现在应该可以正常工作了,请检查:)@MianOmerZia很乐意帮助^^
 <div id="sidebar-wrapper">
        <ul class="sidebar-nav" id="MainMenu">
            <li class="sidebar-brand"><a href="#">Menu</a>
            </li>
            <li><a href="#"><img src="images/icons/home.png">HOME</a>
            </li>
            <li><a href="#">Menu</a>
               <ul class="sidebar-brand">
                 <li><a href="navigation.html">sub menu 1</a></li>
                 <li><a href="#">sub menu 2</a></li>
                 <li><a href="#">sub menu 3</a></li>
                 <li><a href="#">sub menu 4</a></li>
                 <li><a href="#">sub menu 5</a></li>
                 <li><a href="#">sub menu 6</a></li>
               </ul>                  
            </li>
            <li><a href="#">Menu</a>
            </li>
            <li><a href="#">Menu</a>
            </li>
            <li><a href="#">Menu</a>
            </li>
            <li><a href="#">Menu</a>
            </li>
            <li><a href="#">Menu</a>
            </li>
        </ul>
    </div>
#sidebar-wrapper {
  background:url(/images/nav.jpg) no-repeat center; //  an maybe the quotes are not necessary. Check if the path is correct!
  background-size: cover; //  change this to 'contain' if you want to test different modes
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  margin-left: -250px;
  left: 250px;
  width: 250px;
  position: fixed;
  height: 100%;
  overflow-y: auto;
  z-index: 1000;
  transition: all 0.4s ease 0s;
}