Heading with background : Header « Tags « HTML / CSS






Heading with background

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>Image replacement</title>
<style type="text/css" media="screen">
.aFancyHeading {
    position: relative;
    width: 279px;
    height: 28px;
    overflow: hidden;
    font-size: 20px;
    }

.aFancyHeading span {
    position: absolute;
    background: red;
    width: 100%;
    height: 100%;
}
</style>
</head>
<body>
  <h1 class="aFancyHeading"><span></span>This is the heading</h1>
  <p>This is the content. this is a test. this is a test. 
     This is the content. this is a test. this is a test. 
     This is the content. this is a test. this is a test. 
     This is the content. this is a test. this is a test. 
     </p>
</body>
</html>

 








Related examples in the same category

1.Headings
2.Inline style for header 3
3.Header font setting
4.header with absolute position
5.Header text alignment: center
6.Set font size for

7.header 2 background image setting
8.Set font size to 1em
9.Hide
in
10.Use
11.Set

in header

12.Set

in header section

13.Heading with margin
14.Use bold font to highlight heading
15.Adding top and bottom margin for heading
16.Set font for header 1
17.Background with bottom border
18.Border for header
19.Inline style for header
20.

overflow hidden

21.Add the Left Margin
22.Header content section
23.Header, image and content
24.h1 padding: 10px
25.News Header style
26.A fixed header
27.Adding links in to the header
28.Letter Spacing in Headlines