我已經完成了純css切換和工作正常。 現在,我還在切換處於活動狀態時放置了一個代碼,它結束時顯示+符號,當它被點擊並打開時顯示符號。當它關閉時,它必須顯示+符號。如果你們有任何想法,請幫助我。我附上了示例圖像和代碼。這裏是例如圖像(http://highercodetechnologies.com/New_benners/tg.png)檢查+和 - 號css切換+的符號和 -
謝謝
代碼....
/* Clean up the lists styles */
ul.accordion {
list-style: none;
margin: 0;
padding: 0;
}
/* Hide the radio buttons */
/* These are what allow us to toggle content panes */
ul.accordion label + input[type='radio'] {
display: none;
}
/* Give each content pane some styles */
ul.accordion li {
background-color: #ffffff;
border-bottom: 1px solid #ffffff;
}
/* Make the main tab look more clickable */
ul.accordion label {
background-color: #33abde;
color: #FFFFFF;
display: block;
padding: 10px;
font-weight:bold;
}
ul.accordion label:hover {
cursor: pointer;
}
/* Set up the div that will show and hide */
ul.accordion div.content {
overflow: hidden;
padding: 0 10px;
display: none;
}
/* Show the content boxes when the radio buttons are checked */(here I tried to do
that but not working.)
ul.accordion label + input[type='radio']:checked + div.content {
display: block;
}
Html code
<ul class='accordion'>
<li>
<label for='cp-1'>Content pane 1</label>
<input type='radio' name='a' id='cp-1' checked='checked'>
<div class='content'>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac
turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit
amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae
est. Mauris placerat eleifend leo.</p>
</div>
</li>
<li>
<label for='cp-2'>Content pane 2</label>
<input type='radio' name='a' id='cp-2'>
<div class='content'>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac
turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet,
ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est.
Mauris placerat eleifend leo.</p>
</div>
</li>
<li>
<label for='cp-3'>Content pane 3</label>
<input type='radio' name='a' id='cp-3'>
<div class='content'>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac
turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit
amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae
est. Mauris placerat eleifend leo.</p>
</div>
</li>
你想我們會爲你和**免費**寫這個? – Itay
http://www.menucool.com/vertical/accordion-menu-css –