教你小三角,適用移動端等,解決移動端a標簽的默認樣式
阿新 • • 發佈:2017-07-06
utf-8 劃線 hover -s html 出現 class span charset
1.小三角,通過給一個div設置足夠大的邊框,讓它的上邊框,右邊框,左邊框,的背景顏色設置成透明的,來實現,如下:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> #demo { width: 0; height: 0; /*邊框的寬20px*/ border-width: 20px; /*邊框樣式,實線*/ border-style: solid; /*邊框顏色*/ border-color: transparent transparent red transparent; } </style> </head> <body> <!--小三角,transparent透明的,--> <div id="demo"> </div> </body> </html>
2.a標簽的移動端問題:
1》當再點擊a標簽的時候,它會有默認的背景顏色,解決辦法
1 -webkit-tap-highlight-color:transparent;
2》當點擊時可能會出現下劃線,解決方法
1 text-decoration: none; //或者 2 3 border: none;//或者 4 5 outline:none;
3>當鼠標放上去時顯出下劃線,解決辦法;
a:hover{ text-decoration:none; }
a標簽是一個行內標簽,如果要設置它的寬高或多個樣式可通過display:block;將其變為塊級標簽。
教你小三角,適用移動端等,解決移動端a標簽的默認樣式