CSS - border-top



Sets an element's top border; value is one or more of a color, a value forborder-top-width, and a value for border-style.

Possible Values

Possible values are:

Applies to

All the HTML elements.

DOM Syntax

object.style.borderTop = "2px solid red";

Example

The border-top property allows you to specify color, style, and width of top lines in one property. Following example demonstrates this:

  <html>
  <head>
     <style>
        p.example1{
           height:50px;
           border-top: blue 15px solid ;
           }
        p.example2{
          height:50px;
          border-top: red 15px dashed;
          }
        p.example3{
           height:50px;
           border-top: green 15px groove;
           }
     </style>
  </head>
  <body>
        <p class="example1">Check the top border!!!</p>
        <p class="example2">Check the top border!!!</p>
        <p class="example3">Check the top border!!!</p>
  </body>
  </html>
Advertisements