Home  >  Article  >  Web Front-end  >  div里面插入一张图片,li里面也插入一张图片,但是li的图片却在div图片外面_html/css_WEB-ITnose

div里面插入一张图片,li里面也插入一张图片,但是li的图片却在div图片外面_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:35:121789browse

直接上代码吧
 
 

 


 
div里面插入一张图片,li里面也插入一张图片,但是li的图片却在div图片外面_html/css_WEB-ITnose
 

     
  • div里面插入一张图片,li里面也插入一张图片,但是li的图片却在div图片外面_html/css_WEB-ITnose

  •  

  •  

  •  

  •  

  •  

  •  

 

  
 
如上面的代码,用的无序列表标签,现在的想法是想吧li里面的图片放到div图片里面,但是我发现,如果把div的图片放入css,这样li的图片才能在div里面,但是如果直接在div里面插入图片,li的图片就会出现在div的下面,由于客观原因,css里面只能填充背景色,不能插入图片,所以求div里面插入图片,并且让li的图片显示在div里面,多谢了,现在的情况是这个样子的 。看截图


回复讨论(解决方案)

用绝对定位。

相对定位实现,css代码如下:

	div{width:991px;height:559px;margin:100px auto; position:relative;}    div ul{padding:0; position:absolute; left:0px; top:0px; z-index:9;}    *{list-style:none}

谢谢,已经解决,用的确实是相对定位,不过是对li进行的

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn