第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

div的替換,用了z-index,為什么不成功,幫忙看一下?

div的替換,用了z-index,為什么不成功,幫忙看一下?

<div id="example1" class="divcss5-1"></div>  <div id="example2" class="divcss5-2></div><script type="text/css"> .divcss5-1{width:100%;height:20%;margin-left: 40px;margin-top: 10px;z-index:1;} .divcss5-2{width:100%;height:20%;margin-left: 40px;margin-top: 10px;z-index:2;} </script>
查看完整描述

1 回答

?
慕雪6442864

TA貢獻(xiàn)1812條經(jīng)驗(yàn) 獲得超5個(gè)贊

第一種方法:

<div id="example1" class="divcss5-1">1</div>
 <div id="example2" class="divcss5-2">2</div>
<style type="text/css">
    .divcss5-1{position:absolute;top:10px;left:40px;width:100%;height:20%;background-color:#ccc;z-index:1;}    
    .divcss5-2{position:absolute;top:10px;left:40px;width:100%;height:20%;background-color:#eee;z-index:2;}</style>

第二種方法,用的js,點(diǎn)擊div2后可以讓1覆蓋2:

<div id="example1" class="divcss5-1">1</div>
<div id="example2" class="divcss5-2" onclick="aa()">2</div>

<style type="text/css">
    .divcss5-1{position:absolute;top:10px;left:40px;width:100%;height:20%;background-color:#ccc;visibility:none;}    
    .divcss5-2{position:absolute;top:10px;left:40px;width:100%;height:20%;background-color:#eee;}</style><script type="text/javascript">
    function aa(){
        alert("從1隱藏2顯示到2隱藏1顯示");        var a1=document.getElementById("example1");       
         var a2=document.getElementById("example2");
        a1.style.visibility="visible";
        a2.style.visibility="hidden";
    }</script>


查看完整回答
反對(duì) 回復(fù) 2018-11-08
  • 1 回答
  • 0 關(guān)注
  • 446 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)