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.
            Asked
            
        
        
            Active
            
        
            Viewed 3.3k times
        
    0
            
            
        - 
                    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 Answers
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 :
 
    
    
        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
- 
                    1On Android it only worked for when using `html, body {...}` instead of `body {...}`. – Edward Mar 07 '16 at 12:59
 
    