Home > Web Front-end > HTML Tutorial > How can we display the border thickness of an element in HTML?

How can we display the border thickness of an element in HTML?

王林
Release: 2023-09-07 21:33:07
forward
995 people have browsed it

How can we display the border thickness of an element in HTML?

Use the border attribute in HTML to display the thickness of the border.

Note − HTML5 does not support this attribute.

Example

You can try running the following code to understand how to implement the border attribute in HTML −

<!DOCTYPE html>
<html>
   <body>
      <h2>Cricketers</h2>
      <table style="width:100%" border="1">
         <th>Name</th>
         <tr>
            <td>Sachin Tendulkar</td>
         </tr>
         <tr>
            <td>Virat Kohli</td>
         </tr>
      </table>
   </body>
</html>
Copy after login

Please use CSS as border is deprecated in HTML5 Attributes.

<!DOCTYPE html>
<html>
   <head>
      <style>
         table, th, td {
            border: 1px solid black;
         }
      </style>
   </head>
   <body>
      <h2>Cricketers</h2>
      <table style="width:100%">
         <caption>Indian Cricketers</caption>
         <th>Name</th>
         <tr>
            <td>Sachin Tendulkar</td>
         </tr>
         <tr>
            <td>Virat Kohli</td>
         </tr>
      </table>
   </body>
</html>
Copy after login

The above is the detailed content of How can we display the border thickness of an element in HTML?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template