This is my code for a project for my class. I want to add a background image to
ID: 3730349 • Letter: T
Question
This is my code for a project for my class. I want to add a background image to the webpage. The image should not be in a "tiles" pattern and it should not move as I scroll up the webpage. Can someone please help me and tell me where and how I can add a background image. The name for my image is wallpaper.jpg.
1 3 4 head > Midterm Project Our Own Restaurant Professor Archibal New York City College of Technology 10 About Us Author: Sujoy Sarkar Date: March 14, 2018 12 13 14 15 16 17 18 19 29 21 Filename: index.html Us About img src "aroma-jpg" alt "Aroma" width- 800" height-"200" />Explanation / Answer
In <head> after title, just add below code: Comment for any doubt
<style>
body {
background-image: url("wallpaper.jpg");
background-attachment: fixed;
background-repeat: no-repeat;
}
</style>
If you want to cover whole background with image then add below code instead of above
<style>
body {
background-image: url("wallpaper.jpg");
background-attachment: fixed;
background-repeat: no-repeat;
background-size: cover;
}
</style>
If you want to center the image then add below code
<style>
body {
background-image: url("wallpaper.jpg");
background-attachment: fixed;
background-repeat: no-repeat;
background-size: cover;
background-position: center;
}
</style>
If you don't want to use <style> tag, then add below code inside of body. Just removing style tag from first solution.
background-image: url("wallpaper.jpg"); background-attachment: fixed; background-repeat: no-repeat
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.