css3 - selected添加 border???
問題描述
selected添加 border???
問題解答
回答1:.selected{border-bottom:2px solid rgb(255,203,107)}
回答2:樓主,如果是用select寫的話沒辦法設(shè)置這種效果,建議樓主使用ul li寫。我是個新手,簡單寫了一下,需要改的地方還很多,如果有哪里需要改正希望各位大神指摘一下呀~ 簡單寫的,很多地方?jīng)]有做處理,比如真正模擬select框的話,input右側(cè)最好加個箭頭,可以當(dāng)作一個開關(guān)這樣子。
PS:第一次在這里粘代碼段,不知道格式是什么樣子。。。湊合看吧。
html代碼:
<p class='choose'> <input type='text' value='--select--' /> <p class='down-select'><ul> <li><a href='http://www.cgvv.com.cn/wenda/5852.html#'>數(shù)學(xué)</a></li> <li><a href='http://www.cgvv.com.cn/wenda/5852.html#'>英語</a></li> <li><a href='http://www.cgvv.com.cn/wenda/5852.html#'>化學(xué)</a></li> <li><a href='http://www.cgvv.com.cn/wenda/5852.html#'>生物</a></li></ul> </p></p>
css代碼:
* { margin: 0; padding: 0;} a { text-decoration: none; color: #666;} input.select { width: 100px; height: 30px;} p.down-select { display: none; width: 100px; box-shadow: 0 0 2px 2px #cccccc; } p.down-select ul { list-style-type: none; overflow: hidden; width: 100px; border-bottom: 2px solid #ffb200;} p.down-select ul li { line-height: 20px; border-bottom: 1px solid #cccccc; text-align: center; height: 30px; padding-top: 10px;}
js代碼:
$(’input.select’).click(function(e) { e.preventDefault(); $(’.down-select’).show();});$(’.down-select li’).click(function(e) { e.preventDefault(); var selectVal = $(this).find(’a’).text(); $(’.select’).val(selectVal); $(’.down-select’).hide();});
相關(guān)文章:
1. 查詢mysql數(shù)據(jù)庫中指定表指定日期的數(shù)據(jù)?有詳細(xì)2. mysql - 怎么生成這個sql表?3. mysql儲存json錯誤4. php - 公眾號文章底部的小程序二維碼如何統(tǒng)計?5. mysql - 表名稱前綴到底有啥用?6. mysql - 數(shù)據(jù)庫表中,兩個表互為外鍵參考如何解決7. Navicat for mysql 中以json格式儲存的數(shù)據(jù)存在大量反斜杠,如何去除?8. 在mybatis使用mysql的ON DUPLICATE KEY UPDATE語法實(shí)現(xiàn)存在即更新應(yīng)該使用哪個標(biāo)簽?9. mysql - 數(shù)據(jù)庫建字段,默認(rèn)值空和empty string有什么區(qū)別 11010. sql語句 - 如何在mysql中批量添加用戶?
