Set border-top for header in HTML and CSS

Description

The following code shows how to set border-top for header.

Example


<html>
<head>
<style type="text/css">
h2 {<!--from  w ww  . jav  a  2  s.  c  o  m-->
border-top: 10px solid black;
}
</style>
</head>
<body>
<h2>This is a header</h2>
<p>This is a test</p>
</body>
</html>

Click to view the demo

The code above generates the following result.

Set border-top for header in HTML and CSS
Home »
  HTML CSS Tutorial »
    Text »
      Heading
HTML CSS Tutorial Heading
Create page heading from h1 to h6 in HTML a...
Set border-top for header in HTML and CSS
Set heading text align to center in HTML an...
Use Headings to Structure Text in HTML and ...
Use nested border to mark headings in HTML ...