2016-06-01 32 views
2

我已經搜索了很多,並且沒有找到,或者至少我沒有能夠實現正確的答案。由div容器切斷的工具提示

我正在建立一個網站,其中我有一個圖像滾動div。我將工具提示放在圖像的某些部分,但是當它們被激活時,工具提示被div的約束切斷。

工作例如:http://navalage.neocities.org/menu1-test.html

它是在底部菜單。階段工具提示出現在div的內部,我將其他人作爲我希望他們做的一個例子。

希望有人能幫忙,謝謝!

CSS是

<style> 
body { 
background-color: black; 
} 
.div {font-family: san-serif;} 




/* Tooltip container */ 
.tooltip { 
    position: relative; 
    display: inline-block; 
    border: 1px solid ; 
    border-color: rgba(255,255,255,1); 
/* If you want dots under the hoverable text */ 
} 
/* Tooltip text */ 
.tooltip .tooltiptext { 
    visibility: hidden; 
    width: 294px; 
    background-color: black; 
    color: #fff; 
    text-align: center; 
    padding: 5px 0; 
    border-radius: 6px; 
    border: 1px dashed white; 
    font-family: arial; 
    /* Position the tooltip text - see examples below! */ 
    position: absolute; 
    top: 0px; 
    opacity: 0; 
    -mox-transition: 1; 
    z-index:33; 
} 

/* Show the tooltip text when you mouse over the tooltip container */ 
.tooltip:hover .tooltiptext { 
    visibility: visible; 
    opacity: 1; 
    z-index:34; 
} 

</style> 

HTML是;

<div style="z-index: 2; overflow: scroll; max-width: 240px; background-color: black; margin-left: 84px; margin-top: -54px; width: 213px; height: 50px; -moz-transform: skew(1.5deg);"> 







<!-- Stage --> 

<div class="tooltip" style="z-index: 3; margin-top:2px; margin-left: 0px; width: 35; height: 44px;"> 
<span style="margin-left: -84px; margin-top: -0px; z-index: 999;" class="tooltiptext"><b><u>Stage</b></u>: This is where you go to battle the enemy in the main story line (there isnt much of one).</span> 
</div> 

<img src="IMAGES/mainmenu.jpg" style="height:50px; margin-left: -5px; margin-top: -47px; -moz-transform: skew(-1.5deg);"> 

<!-- END --> 

<!-- Fleet --> 

<div class="tooltip" style="top: 489px; left: 130px; width: 35; height: 44px;"> 
<span style="margin-left: -120px; margin-top: -110px;" class="tooltiptext"><b><u>Fleet</b></u>: Here you can set up your base defence when somebody is attacking. You can also repair your ships and check on the current status of any fleets on a mission.</span> 
</div> 

<!-- END --> 

<!-- Alliance --> 

<div class="tooltip" style="position: absolute; top: 489px; left: 168px; width: 35; height: 44px;"> 
<span style="margin-left: -158px; margin-top: -91px;" class="tooltiptext"><b><u>Alliance</b></u>: Acces your alliance for donations, Elite Challenges (EC), Alliance fleet, Collect Supplies, Alliance War, and alliance technology.</span> 
</div> 

<!-- END --> 


<!-- Item --> 

<div class="tooltip" style="position: absolute; top: 489px; left: 206px; width: 35; height: 44px;"> 
<span style="margin-left: -196px; margin-top: -53px;" class="tooltiptext"><b><u>Item</b></u>: Acces your items, as well as the shop, and flash sale.</span> 
</div> 

<!-- END --> 

<!-- Mail --> 

<div class="tooltip" style="position: absolute; top: 489px; left: 244px; width: 35; height: 44px;"> 
<span style="margin-left: -234px; margin-top: -91px;" class="tooltiptext"><b><u>Mail</b></u>: This is where you recieve mail from system, friends, alliance leaders, escort, scout reports, and attack and defense reports. </span> 
</div> 

<!-- END --> 


<!-- NEXT --> 
<div class="tooltip" style="position: absolute; top: 489px; left: 282px; width: 25; height: 44px;"> 
<span style="margin-left: -272px; margin-top: 0px;" class="tooltiptext">Go to the next menu page 
<a href="menu2.html"> 
<button> 
Next</button> 
</a> 

</span> 
</div> 

<!-- END --> 






</div> 
+1

請共享代碼或爲我們提供了一個小提琴。 –

回答

0

你必須改變你的CSS在這個div和跨越

<div class="tooltip" style="z-index: 3;margin-top:2px;margin-left: 0px;width: 35;height: 44px;position: absolute;"> 
<span style="margin-left: -84px;margin-top: -72px;/* z-index: 999; */" class="tooltiptext"><b><u>Stage</u></b>: This is where you go to battle the enemy in the main story line (there isnt much of one).</span> 
</div> 
+0

它仍然沒有把工具提示放在div之外。 – VictorScott

+0

我也是這樣做的。只需將您的舊DIV替換爲此DIV即可。它會起作用 –

+0

我很難看到這是一個工作結果。這將該物品放置在我的div外面,這立即使它們無用。他們在div中,所以他們可以與圖像一起滾動。目標是將可移動內容留在div內,同時使工具提示彈出窗口出現在div的約束之外。 – VictorScott