Simple HTML programs


How to set the background color using HTML code?

 

<html>
<head>
<style type="text/css">
body {background-color: yellow}
h1 {background-color: #00ff00}
h2 {background-color: transparent}
p {background-color: rgb(250,0,255)}
</style>

</head>
<body>
<h1>This is header 1</h1>
<h2>This is header 2</h2>
<p>This is a paragraph</p>
</body>
</html>

 

How to set an image as the background using HTML code?

 

<html>
<head>
<style type="text/css">
body
{
background-image:
url('bgdesert.jpg')
}
</style>

</head>
<body>
</body>
 </html>

 

How to repeat a background image?


<html>
<head>
<style type="text/css">
body
{
background-image:
url('bgdesert.jpg');
background-repeat: repeat
}
</style>


</head>
 <body>
</body>
</html>
 

How to place the background image?


<html>
<head>
<style type="text/css">
body
{
background-image:
url('smiley.gif');
background-repeat:
no-repeat;
background-position:
center;
}
</style>

</head>
 <body>
</body>
</html>

Comments

Popular posts from this blog

A Javascript Program To make (open new window and close that window) button in your web browser.

A simple running clock in javascript