Search code examples
htmlcssbackground-repeat

Background stretch image HTML coding error


I am a begginer on coding i learned coding from: ProgrammingKnowledge youtube channel. I want to make a background stretch image it works but it repeats it self. I searched in google none of these work. They just make my text UNDER the background, cover up text. Please could someone tell me the code? the img is in my folder and my code is here: http://pastebin.com/ptybcjcg


Solution

  • I think you mean this. Add this to the css of the thing that has the background:

    .classname{
        background-size: cover;
    }
    

    Another property for background-size that could be what you want is

    background-size: contain;
    

    I hope this helps you.