在html5中,可以利用border屬性來取消邊框,該屬性會在一個聲明中設置所有的邊框屬性,當該屬性的值設置為“0”時就會取消邊框的樣式,語法為“<element border="0">”。
本教程操作環(huán)境:windows10系統(tǒng)、CSS3&&HTML5版本、Dell G3電腦。
html5怎么取消邊框
border 屬性在一個聲明中設置所有邊框屬性。
語法:
Object.style.border=borderWidth borderStyle borderColor
示例如下:
<html> <head> <style type="text/css"> p { border: thin dotted #FF0000; } </style> <script type="text/javascript"> function changeBorder() { document.getElementById("p1").style.border="none"; } </script> </head> <body> <input type="button" onclick="changeBorder()" value="Change border" /> <p id="p1">This is a paragraph</p> </body> </html>
輸出結果:
示例:
<html> <body> <table border="1"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> </table> <table border="0"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> </table> </body> </html>
輸出結果:
(學習視頻分享:css視頻教程、html視頻教程)