Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-20-2009, 10:04 PM   PM User | #1
surreal5335
Regular Coder

 
Join Date: May 2008
Posts: 446
Thanks: 23
Thanked 5 Times in 5 Posts
surreal5335 is an unknown quantity at this point
trouble using image as background in css

I went through a couple tutorials on placing images as backgrounds and I am not getting anything.

I have tried the following syntax formats so far:

background-image: url('border_top.png');

background-image: url('/photo_site/border_top.png');

background-image: url("/photo_site/border_top.png");

background-image: url(/photo_site/border_top.png);

I am trying to use it to wrap a split up border around a set of images which will be viewed in jquery cycle.

so far nothing is showing up.

http://royalvillicus.com/photo_site/...e/photo_1.html

Thanks a lot for your help
surreal5335 is offline   Reply With Quote
Old 05-20-2009, 10:08 PM   PM User | #2
quartzy
Regular Coder

 
Join Date: May 2009
Posts: 813
Thanks: 123
Thanked 24 Times in 24 Posts
quartzy is an unknown quantity at this point
re

The syntax you are using is correct for the first one, if the image is in the same directory. But the others will not work, unless you specify the folder used before the ( / )
quartzy is offline   Reply With Quote
Old 05-21-2009, 06:10 AM   PM User | #3
surreal5335
Regular Coder

 
Join Date: May 2008
Posts: 446
Thanks: 23
Thanked 5 Times in 5 Posts
surreal5335 is an unknown quantity at this point
Thanks a lot for the info. I tried the suggestion you made but still no dice.

One note I should make, in order for me to be able to call images or files consitently I had to put a (/) in the begining if it was being stored in a child folder. I am not sure if that is just a firefox thing or what.

So maybe the problem is not the calling of images then, could be something else. I have included the two vital pieces of code I use on this border. Its pretty easy to see what my thought process was. Hopefully you can find something wrong with it. :P

Code:
.roundtop {
	
    background-image: url('photo_site/border_top.png');
    width: 630px;
    
    
    	}
    
    
.pics {

    background-image: url('photo_site/border_middle.png');
    background-repeat: repeat-y;
    width: 630px;
    text-align: center;
    
	}


.roundbottom 	{

    background-image: url('photo_site/border_bottom.png');
    width: 630px;
   
   
	}

Code:
<div class="roundtop"></div>

<div id="s1" class="pics">
<img src="/photo_site/pictures/bee.png" alt="1a" height="400" width="600"/>
<img src="/photo_site/pictures/Bridge.jpg" alt="1b" height="400" width="600"/>
<img src="/photo_site/pictures/Cat.jpg" alt="1c" height="400" width="600"/>
<img src="/photo_site/pictures/desert.jpg" alt="1d" height="400" width="600"/>
<img src="/photo_site/pictures/France.jpg" alt="1e" height="400" width="600"/>
<img src="/photo_site/pictures/House.jpg" alt="1f" height="400" width="600"/>
 	</div>

<div class="roundbottom"></div>
Thanks a lot
surreal5335 is offline   Reply With Quote
Old 05-21-2009, 07:40 AM   PM User | #4
jhaycutexp
Regular Coder

 
Join Date: Apr 2008
Location: Manila, Philippines
Posts: 249
Thanks: 2
Thanked 12 Times in 12 Posts
jhaycutexp is an unknown quantity at this point
try putting display:block on the class pics..

or.. add <div style="clear:both;"></div>
Code:
<div class="roundtop"></div>

<div id="s1" class="pics">
<img src="/photo_site/pictures/bee.png" alt="1a" height="400" width="600"/>
<img src="/photo_site/pictures/Bridge.jpg" alt="1b" height="400" width="600"/>
<img src="/photo_site/pictures/Cat.jpg" alt="1c" height="400" width="600"/>
<img src="/photo_site/pictures/desert.jpg" alt="1d" height="400" width="600"/>
<img src="/photo_site/pictures/France.jpg" alt="1e" height="400" width="600"/>
<img src="/photo_site/pictures/House.jpg" alt="1f" height="400" width="600"/>


here..

<div style="clear:both;"></div>
 	</div>

<div class="roundbottom"></div>
jhaycutexp is offline   Reply With Quote
Old 05-21-2009, 08:26 AM   PM User | #5
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
Originally Posted by quartzy View Post
The syntax you are using is correct for the first one, if the image is in the same directory. But the others will not work, unless you specify the folder used before the ( / )
That wasn't a good suggestion, and the OP needs the forward slashes in the url() to link those images with the stylesheet (other wise there should be some kinda ../ things). I'm running out of time (), so I'd recommend to check http://www.codingforums.com/showthread.php?t=158883, to get some idea.

I'm not sure about how you are planning to make a rounded box, though, you need to set a suitable width to your empty divs to show them by the browser, like
Code:
.roundtop {
background-image:url(/photo_site/border_top.png);
height:50px;
width:630px;
}
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:30 AM.


Advertisement
Log in to turn off these ads.