将鼠标悬停在主按钮上时会显示辅助按钮

时间:2014-04-25 09:39:41

标签: html button

是否可以创建辅助按钮,这些按钮会在人物悬停或点击主按钮时显示? 因此主按钮可以是#34; train"。然后当您将鼠标悬停在该按钮上时,将显示2个附加辅助按钮,例如"训练1"和#34;训练2"。

<div id="button_group">
    <button type = "button"  class = "Button" id="trains" > Trains </button> <br />
    <button type = "button"  class = "Button" id="train1" > Train 1 </button> <br />
    <button type = "button"  class = "Button" id="train2" > Train 2 </button> <br />
</div>

1 个答案:

答案 0 :(得分:0)

http://jsfiddle.net/m9vZn/

添加此CSS:

#train1, #train2 {
    display: none;
}
#button_group:hover > button {
    display: inline-block;
}