background: gray : background « CSS « HTML / CSS






background: gray

   
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <title> </title>
        <style type='text/css' media='all'>
            body {
                font-size: 12px;
            }
            h1 {
                font-size: 2.1em;
                background: pink;
                padding: 1em;
                border: thin solid black;
            }
            p {
                font-size: 0.9em;
                padding: 1em;
                border: thin solid black;
                background: gray;
                color: white;
            }
        </style>
    </head>
    <body>
        <h1>
            This is a heading
        </h1>
        <p>
            This is a paragraph of text.
        </p>
    </body>
</html>

   
    
  








Related examples in the same category

1.'background' Example
2.The background shorthand property provides for specifying all five separate background properties in one single property.
3.background: mistyrose
4.background: rgb(128, 128, 128)
5.The background-color value can be transparent keyword, which is also the default value.
6.The background-color value can be a hexadecimal value
7.The background-color value can be a short hexadecimal value
8.background: yellow;
9.background: white url('http://java2s.com/style/logo.png') center center; (image and position)
10.background: url('http://java2s.com/style/logo.png') repeat-x; (background-image-repeat)
11.background: url('http://java2s.com/style/logo.png') repeat-y scroll; (background image repeat attachment)
12.background: mistyrose;
13.background: pink;
14.background: lightyellow;
15.background: rgb(234, 234, 234);
16.background: yellowgreen;
17.background: no-repeat fixed bottom center;
18.background x tiled
19.background y tiled
20.Background fixed
21.Whole page background
22.Whole page shading effect
23.HTML and CSS for background colors
24.Using more than one background image
25.Merge several image to one big background image
26.CSS Background Attributes Example
27.Link with background
28.hr border: none; background-color: #256579; color: #256579; height: 2px; width: 80%;
29.tfoot td background: #808080;color: white;
30.background attachment: fixed
31.option background-color: #3CB371;color: #ffffff;
32.code padding:3px; background-color:black; color:#FFFFFF;
33.background-attachment: fixed;
34.demonstrating the background-color property
35.Background grid
36.a:hover {color:#FF9900; text-decoration:underline; background-color:#f9f0f0;}
37.thead, tfoot {border:solid; background-color:#efefef; font-size:36px;}
38.Update background image when mouse hover
39.Using background image for DIV
40.background: url(img/document.gif) no-repeat left center;
41.Change background when mouse hover
42.a:hover background: inherit;
43.Using shade image to as the title bar background
44.Round corner with background image
45.Shading background
46.Blue background
47.Black background
48.background: #ffffff url(1024px-images/background.gif) top center repeat-y;
49.Round corner with background image 2
50.Block quote with background
51.background: rgb(244, 244, 244);
52.The background shorthand property
53.background assigns the padding area inside the box to a background color and/or image.
54.Set URL for Background Image
55.Background with no repeat
56.Add background image to LI
57.background: lightblue
58.background: lightgreen
59.background: pink
60.Css Rollover with image