Computer >> Computer tutorials >  >> Programming >> HTML

Create a style definition in HTML


The HTML <style> tag is used for declaring style sheets within the head of your HTML document.

The following are the attributes

Attribute
Value
Description
type
text/css
Specifies the style sheet language as a content-type (MIME type).
media
screen
Specifies the device the document will be displayed on.

tty
tv
projection
handheld
print
braille
aural
all

Example

You can try to run the following code to create a style definition in HTML −

<!DOCTYPE html>
<html>
   <head>
      <style>
         table, th, td {
         border: 1px solid black;
         }
      </style>
   </head>
   <body>
      <h3>Ranking</h3>
      <table>
         <th>Rank</th>
         <tr>
            <td>One</td>
         </tr>
         <tr>
            <td>Two</td>
         </tr>
      </table>
   </body>
</html>