- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a full-page background image with CSS?
Following is the code to create a full-page background image with CSS −
Example
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> body, html { height: 100%; margin: 0; } .background { background-image: url("https://images.pexels.com/photos/1424246/pexels-photo-1424246.jpeg? auto=compress&cs=tinysrgb&dpr=1&w=1000"); height: 100%; background-position: center; background-repeat: no-repeat; background-size: cover; } </style> </head> <body> <div class="background"></div> </body> </html>
Output
The above code will produce the following output −
Advertisements