w3resource
HTML exercises

CSS Properties: How to specify a fixed background-image?

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>How to specify a fixed background-image</title>
<style type="text/css">
body {
background-image: url("https://www.w3resource.com/images/w3resource-logo.png");
background-repeat: no-repeat;
background-attachment: fixed;
}
</style>
</head>
<body>
<p>w3resource Tutorial</p>
</body>
</html>

Live Demo:

See the Pen background-attachment by w3resource (@w3resource) on CodePen.


See the solution in the browser

Supported browser

Firefox logo Chrome logo Opera logo Safari logo Internet Explorer logo
Yes Yes Yes Yes No

Go to Exercise page

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming