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è)最好加個箭頭,可以當作一個開關(guān)這樣子。
PS:第一次在這里粘代碼段,不知道格式是什么樣子。。。湊合看吧。
html代碼:
<p class='choose'> <input type='text' value='--select--' /> <p class='down-select'><ul> <li><a href='http://www.intensediesel.com/wenda/5852.html#'>數(shù)學</a></li> <li><a href='http://www.intensediesel.com/wenda/5852.html#'>英語</a></li> <li><a href='http://www.intensediesel.com/wenda/5852.html#'>化學</a></li> <li><a href='http://www.intensediesel.com/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. javascript - 如果所有請求都放到actions 里面,那拿到的數(shù)據(jù)應該 放在哪里,state 還是vue實例里面的data?2. html - eclipse 標簽錯誤3. 求大神幫我看看是哪里寫錯了 感謝細心解答4. php自學從哪里開始?5. javascript - JS設(shè)置Video視頻對象的currentTime時出現(xiàn)了問題,IE,Edge,火狐,都可以設(shè)置,反而chrom卻...6. javascript - 數(shù)組原聲方法中的一段代碼7. 數(shù)據(jù)庫 - MySQL 單表500W+數(shù)據(jù),查詢超時,如何優(yōu)化呢?8. javascript - 怎么實現(xiàn)移動端頁面滑動切換,從1可以滑到2 但是不能從2滑回1 這樣的效果呢?9. phpstady在win10上運行10. phpstudy v8打開數(shù)據(jù)庫就出錯,而phpstudy 2018不會
