Home
HTML
HTML Background Image
Example 6: HTML Background Image
Run ❯❯
<!DOCTYPE html> <html> <head> <title>Background Image Size by Length Example</title> <style> body { background-image: url('trees.jpg'); background-repeat: no-repeat; background-attachment: fixed; background-size: 200px 200px; } </style> </head> <body> <h1>Background Image Size by Length</h1> <p style="color:red;">We have set width and height of the background image to 200 px in CSS background-size property. Change the size and see the difference.</p> </body> </html>