css3 - selected添加 border???
問題描述
selected添加 border???
問題解答
回答1:.selected{border-bottom:2px solid rgb(255,203,107)}
回答2:樓主,如果是用select寫的話沒辦法設置這種效果,建議樓主使用ul li寫。我是個新手,簡單寫了一下,需要改的地方還很多,如果有哪里需要改正希望各位大神指摘一下呀~ 簡單寫的,很多地方?jīng)]有做處理,比如真正模擬select框的話,input右側(cè)最好加個箭頭,可以當作一個開關這樣子。
PS:第一次在這里粘代碼段,不知道格式是什么樣子。。。湊合看吧。
html代碼:
<p class='choose'> <input type='text' value='--select--' /> <p class='down-select'><ul> <li><a href='http://www.baoyu77737.com/wenda/5852.html#'>數(shù)學</a></li> <li><a href='http://www.baoyu77737.com/wenda/5852.html#'>英語</a></li> <li><a href='http://www.baoyu77737.com/wenda/5852.html#'>化學</a></li> <li><a href='http://www.baoyu77737.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();});
相關文章:
1. javascript - 使用form進行頁面跳轉(zhuǎn),但是很慢,如何加一個Loading?2. python 計算兩個時間相差的分鐘數(shù),超過一天時計算不對3. docker-compose中volumes的問題4. javascript - 后臺管理系統(tǒng)左側(cè)折疊導航欄數(shù)據(jù)較多,怎么樣直接通過搜索去定位到具體某一個菜單項位置,并展開當前菜單5. docker-machine添加一個已有的docker主機問題6. angular.js - 輸入郵箱地址之后, 如何使其自動在末尾添加分號?7. javascript - ES6規(guī)范下 repeat 函數(shù)報錯 Invalid count value8. javascript - html5的data屬性怎么指定一個function函數(shù)呢?9. html5 - 為什么使使用vue cli 腳手架,post-css 沒有自動對css3屬性自動添加瀏覽器前綴呢?10. javascript - 如何使用nodejs 將.html 文件轉(zhuǎn)化成canvas
