首頁  >  文章  >  web前端  >  框覆盖时会覆盖背景但不覆盖文字,如何设置?_html/css_WEB-ITnose

框覆盖时会覆盖背景但不覆盖文字,如何设置?_html/css_WEB-ITnose

WBOY
WBOY原創
2016-06-21 09:40:182315瀏覽

上面的框可以覆盖下面框的背景,但不会覆盖下面的文字,应如何设置?

回复讨论(解决方案)

发下代码看看,不然不好说

设置z-index的值,http://www.w3school.com.cn/css/pr_pos_z-index.asp

 
hello
 hello
test   


hello2
test2


上面的test能够透过背景色看到。

position:relative;
定位可以吧,在两个style都加上这个

<div style=" border:1px solid red; width:50px; position:absolute ; background-color: gray;  z-index:10; "  > hello<br/> hello<br/>test   </div><div style=" border:1px solid green; width:50px;position:absolute; background-color: yellow;  z-index:0; top:30px;  "  >hello2<br></br>test2</div>

position改成absolute以后就可以用z-index设置它了,z-index越大 ,离用户越近

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn