0

I am currently working on building my portfolio website. I am using HTML and CSS. I have an image I am using for my background but the background remains the same size regardless of the size of the screen. What code should I use? Should I upgrade my code to CSS3/HTML5 and if so what would be the code for that? Thank you very much for your time and help ahead of time, this is a detail that is driving me nuts and a huge hang up when showing my work.

Sumner Evans
  • 8,951
  • 5
  • 30
  • 47
user3435927
  • 1
  • 1
  • 1
  • 1
  • Possible duplicate of [CSS background image to fit width, height should auto-scale in proportion](http://stackoverflow.com/questions/9262861/css-background-image-to-fit-width-height-should-auto-scale-in-proportion) – Alex Angas Mar 01 '16 at 00:57

2 Answers2

3
background-size : 100% auto

this gonna set width to 100% and height to auto

always search well before you post a question , this might be a good reference as a beginner :

http://www.w3schools.com/cssref/css3_pr_background-size.asp

ProllyGeek
  • 15,517
  • 9
  • 53
  • 72
2

Have a look at the code below:

html { 
  background: url(images/bg.jpg) no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}
manosim
  • 3,630
  • 12
  • 45
  • 68