CSS Set Position a background image Code For Website - Learn About Website | DaddyFile

0

Background Image - Set position and no-repeat Explain

Showing the background image only once is also specified by the background-repeat property.



Html Code:

<!DOCTYPE html>
<html>
<head>
<style>
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>background no-repeat, set position example.</p>
<p>Now the background image is only shown 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>





Html Code Result:


Post a Comment

 
Top