Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

background images not being called on html when using stylesheet

Hello everyone I have a quick question. I am learning about HTML and CSS using Visual Studio 2012. I am trying to have multiple backgrounds to try a parallax effect type of thing. I know CSS can have multiple backgrounds like so:

    background: url("/file/image.png"), url("/file/images2,png"), etc.....

But what I am trying to do is call the images using the div id selector like so

    #image1 { background:url ("/file/image.png");}


    #image2 { background: url ("/file/image2.png");}

HTML

    <body>

    <div id="image1"></div>
    <div id="image2"></div>

Every time I run the following code I don't have anything showing on screen. The only time I get something is if I put the code on the body{ }. Am I missing something or is VS 2012 not set up properly?

Thanks

like image 686
user1816792 Avatar asked Mar 24 '26 21:03

user1816792


1 Answers

Define the height and width of the image in your css style

#image1 { background:url ("/file/image.png"); height: xxxpx; width: xxxpx;}
#image2 { background: url ("/file/image2.png"); height: xxxpx; width: xxxpx;}
like image 107
admoghal Avatar answered Mar 26 '26 10:03

admoghal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!