Page 114 - DCAP408_WEB_PROGRAMMING
P. 114
Web Programming
Notes
Example: How to position a background image
<html>
<head>
<style type="text/css">
body
{
background-image:url('img_tree.png');
background-repeat:no-repeat;
background-position:right top;
margin-right:200px;
}
</style>
</head>
<body>
<h1>Hello World!</h1>
<p>W3Schools background no-repeat, set postion example.</p>
<p>Now the background image is only show once, and positioned away from the
text.</p>
<p>In this example we have also added a margin on the right side, so the
background image will never disturb the text.</p>
</body>
</html>
Result:
108 LOVELY PROFESSIONAL UNIVERSITY