本文通過執行個體代碼給大家介紹了用CSS樣式寫選擇框右側小三角的方法,需要的朋友參考下吧,希望能協助到大家。
如下所示:
直接上代碼!
<!DOCTYPE html><html lang="en"><head><title>小三角</title><style>.up-triangle{width:0px;height:0px;border-bottom:30px solid #000;border-left:15px solid transparent;border-right:15px solid transparent;margin:100px auto; }.down-triangle{width:0px;height:0px;border-top:30px solid #000;border-left:15px solid transparent;border-right:15px solid transparent; margin:100px auto; }.left-triangle{width:0px;height:0px;border-right:30px solid #000;border-top:15px solid transparent;border-bottom:15px solid transparent; margin:100px auto; }.right-triangle{width:0px;height:0px;border-left:30px solid #000;border-top:15px solid transparent;border-bottom:15px solid transparent; margin:100px auto; }</style></head><body><p class="up-triangle"></p><p class="down-triangle"></p><p class="left-triangle"></p><p class="right-triangle"></p></body></html>