我試圖創建將在內容上浮動的html表單。按鈕將浮動內容和點擊每個按鈕不同的div格式應該出現在下面。就像下面的屏幕截圖一樣。它只在首次出現時顯示按鈕,並且點擊每個按鈕下面的表格應該附加並出現。在最後一個按鈕的情況下,應該出現帶額外按鈕的上下文菜單。帶上下文菜單和按需表單的浮動按鈕
我試圖創建按鈕和形式,而是如何:
1)添加給按鈕的看樣,以按鈕1,按鈕2 ...這是DIV
2)單擊顯示上下文菜單在最後一個按鈕
3)隱藏和顯示上點擊相應的按鈕
的適當形式html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
#content {
width: 100%;
height: 100%;
background-color: #FBBC06;
}
#form {
width: 300px;
background-color: rgba(255, 255, 255, 0.65);
height: 50px;
position: absolute;
top: 36px;
right: 168px;
border: 1px solid darkred;
border-radius: 22px;
}
.widthHeight {
width: 100%;
height: 100%;
}
#button1 {
background-color: aquamarine;
height: 50px;
width: 20%;
border-radius: 25px 0px 0px 25px;
border: 1px solid blue;
display: inline-block;
}
#button2 {
height: 50px;
width: 20%;
background-color: aquamarine;
display: inline-block;
}
#button3 {
height: 50px;
width: 20%;
background-color: aquamarine;
display: inline-block;
border: 1px solid blue;
}
#button4{
height: 50px;
width: 20%;
background-color: aquamarine;
display: inline-block;
border: 1px solid blue;
}
#button5 {
height: 50px;
width: 12%;
background-color: aquamarine;
display: inline-block;
border-radius: 0px 25px 25px 0px;
border: 1px solid blue;
}
#form1{
width: 100%;
height: 200px;
border: 1px solid yellow;
background-color: skyblue;
margin-top: 13px;
}
#form2 {
width: 100%;
height: 200px;
border: 1px solid yellow;
background-color: skyblue;
margin-top: 13px;
}
#form3 {
width: 100%;
height: 200px;
border: 1px solid yellow;
background-color: skyblue;
margin-top: 13px;
}
<div class="widthHeight">
<div id="content">
</div>
<div id="form">
<div id="buttonHolder">
<div id="button1">
button1
</div>
<div id="button2">
buton2
</div>
<div id="button3">
button3
</div>
<div id="button4">
button4
</div>
<div id="button5">
button5
</div>
</div>
<div id="form1">
This is form 1 on click of button 1 it appears
</div>
<div id="form2">
This is form 1 on click of button 1 it appears
</div>
<div id="form3">
This is form 1 on click of button 1 it appears
</div>
</div>
</div>
你應該看看css'display:none'。將它與'display:block'結合使用應該很容易得到你想要的。 –
我應該在按鈕中添加什麼CSS來看起來像可點擊的按鈕。它的正義div現在 – Sumeet
那麼,我的意思是說,你會使用JavaScript來觸發css的變化(使用jQuery的簡單,沒有必要),例如。 '(「#button1」)。click(()=> $(「#form1」)。css('display','block'))'如果你還在家,我會回家看看不明白。 –