table border='1' - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:table

Introduction

The table element has the border attribute.

The value assigned to the border attribute must be 1 or the empty string "".

The border attribute in table element doesn't control the style of the border.

You don't have to add the border attribute to a table to style borders with CSS.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
   <head> 
      <title>Example</title> 
   </head> 
   <body> 
      <table border="1"> 
         <caption>
            Results of the 2020 Survey<!--from w  ww .j  a v  a  2  s. c om-->
         </caption> 
         <colgroup id="colgroup1"> 
            <col id="col1And2" span="2"> 
            <col id="col3"> 
         </colgroup> 
         <colgroup id="colgroup2" span="2"></colgroup> 
         <thead> 
            <tr> 
               <th>Rank</th>
               <th>Name</th>
               <th>Level</th>
               <th colspan="2">Size &amp; Votes</th> 
            </tr> 
         </thead> 
         <tbody> 
            <tr> 
               <th>Favorite:</th>
               <td>CSS</td>
               <td>Green</td>
               <td>Medium</td>
               <td>500</td> 
            </tr> 
            <tr> 
               <th>2nd Favorite:</th>
               <td>HTML</td>
               <td>Orange</td>
               <td>Large</td>
               <td>450</td> 
            </tr> 
            <tr> 
               <th>3rd Favorite:</th>
               <td>SQL</td> 
               <td colspan="2" rowspan="2"> this is a test. this is a test. this is a test. </td> 
               <td>203</td> 
            </tr> 
            <tr> 
               <th rowspan="2">Joint 4th:</th> 
               <td>Oracle</td> 
               <td rowspan="2">75</td> 
            </tr> 
            <tr> 
               <td>Python</td> 
               <td>Ruby</td> 
               <td>Javascript</td> 
            </tr> 
         </tbody> 
         <tfoot> 
            <tr> 
               <th colspan="5">? 2019 java2s.com</th> 
            </tr> 
         </tfoot> 
      </table>  
   </body>
</html>

Related Tutorials