Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap - Set the Background of a Container

So for example the picture below I'm having typing giving each class="container" it's separate background colour/picture.

<div id="p" class="container">
</div>

style sheet

p.container {
     background-image: url(img/this_is_top.png) repeat;
}

CHANGING QUESTION for some reason I have having trouble in setting a background Image* for it.

enter image description here

like image 777
Jack Avatar asked Jan 14 '23 03:01

Jack


2 Answers

Regarding your background image problem you currently have

background-image: url(img/this_is_top.png) repeat;

This is wrong. But you are thinking of the background shorthand CSS property which follows this syntax:

#p.container {background:#ffffff url('img/this_is_top.png') no-repeat center center;}

And if you are styling in your stylesheet and your folder hierarchy is the usual (/~/>/img etc) then it should be:

#p.container {
     background-image: #ffffff url('../img/this_is_top.png') repeat center center;
}

Notice the double dots before the url to tell CSS to look up a level for the img folder

like image 53
adaam Avatar answered Jan 16 '23 17:01

adaam


For starters, having multiple id's with the same name on the same page is not such a great idea. http://css-tricks.com/the-difference-between-id-and-class/

like image 22
David Taiaroa Avatar answered Jan 16 '23 19:01

David Taiaroa