一、看了網上不少關於css的手風琴案例,可是都沒有講到相關的原理。css
主要原理1. 利用target屬性。2.錨點連接。html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>手風琴</title>
<style>
*{transition:all 2s linear}
ul{wdith:700px;}
li{list-style:none;margin-bottom:20px;width:700px}
li a{color:#fff;text-decoration:none;width:700px;height:50px;border-radius:20px;padding: 0 10px;line-height:50px;display:block;position:relative;text-shadow:2px 2px 1px #eee;font-size:30px;font-weight:900;background:linear-gradient(to right,#999,#FFC,#F6F)}spa
span{border:5px solid transparent; border-top-color:#fff;border-bottom:none;width:0;position:absolute;top:23px;right:5px; transition: all 1s linear}
li a:hover{background:linear-gradient(to left,#F99, #FC3, #93C)}
a:hover span{transform:rotate(-90deg)}
p{width:100%;height:0;overflow:hidden}
p:target{height:150px;transition:all 0.5s linear;}orm
/*將四個角的顏色都寫出來,能夠看出來,是在這個正方形的中心點旋轉的,當旋轉90deg時,上面的角會到右邊,因此看起來像下來的感受htm
當下邊框不存在的時候,高度會發生變化,中心點也會發生變化*/
</style>
</head>three
<body>
<ul>
<li>
<a href="#one">brand<span></span></a>
<p id="one">》《南都娛樂週刊》舉辦新生代四小花旦的評選活動,楊穎以總分70分的綜合得分與劉詩詩得到第十三屆華語電影傳媒大獎「最受矚目女演員獎」。2013年1月,《南都娛樂週刊》舉辦新生代四小花旦的評選活動,楊穎以總分70分的綜合得分與劉詩詩得到第十三屆華語電影傳媒大獎「最受矚目女演員獎」。2013年1月,《南都娛樂週刊》舉辦新生代四小花旦的評選活動,楊穎以總分70分的綜合得分與劉詩詩</p>
</li>
<li>
<a href="#two">brand<span></span></a>
<p id="two">》《南都娛樂週刊》舉辦新生代四小花旦的評選活動,楊穎以總分70分的綜合得分與劉詩詩得到第十三屆華語電影傳媒大獎「最受矚目女演員獎」。2013年1月,《南都娛樂週刊》舉辦新生代四小花旦的評選活動,楊穎以總分70分的綜合得分與劉詩詩得到第十三屆華語電影傳媒大獎「最受矚目女演員獎」。2013年1月,《南都娛樂週刊》舉辦新生代四小花旦的評選活動,楊穎以總分70分的綜合得分與劉詩詩</p>
</li>
<li>
<a href="#three">brand<span></span></a>
<p id="three">》《南都娛樂週刊》舉辦新生代四小花旦的評選活動,楊穎以總分70分的綜合得分與劉詩詩得到第十三屆華語電影傳媒大獎「最受矚目女演員獎」。2013年1月,《南都娛樂週刊》舉辦新生代四小花旦的評選活動,楊穎以總分70分的綜合得分與劉詩詩</p>
</li>
</ul>
</body>
</html>utf-8