Home
HTML
HTML Background Image
Example 8: HTML Background Image
Run ❯❯
<!DOCTYPE html> <html> <head> <title>background-size: cover</title> <style> body { background-image: url('trees.jpg'); background-repeat: no-repeat; background-attachment: fixed; background-size: cover; } </style> </head> <body> <h1>background-size: cover</h1> <p style="color:red;">Here the CSS background-size property is set to 'cover'.<br> The browser scales the image by maintaining its aspect ratio. <br>Due to this you may notice that some parts of image are not visible.</p> </body> </html>