Examples of...
Popular examples
Top Examples
Examples of Position a background image with CSS
Position a background image with CSS
How to position a background image, here one example:
<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>
Is this example useful?
To share this example, copy and paste this code into your website, blog or forum:
<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>
Is this example useful?
To share this example, copy and paste this code into your website, blog or forum:
Comments
To leave a comment, you must register for free a> or if you are already registered log in.
Has not written any comments yet.
Has not written any comments yet.
Related examples
Background color of elements Posted on 2011-01-14 14:01:40
Set the background color of a page with this script:
<html>
<head>
<style type="text/css">
h1{background-color:#6495ed;}
...Background color of a page Posted on 2011-01-14 14:00:31
Set the background color of a page with this script:
<html>
<head>
<style type="text/css">
body
{
background-color:#b0c4d...