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 01-14-2012, 02:13 PM   PM User | #1
nickburrett
New Coder

 
Join Date: Jun 2009
Posts: 63
Thanks: 22
Thanked 0 Times in 0 Posts
nickburrett is an unknown quantity at this point
Position background images

Hello

I am trying to get the background image images/home-middle.png to appear 186 pixels below images/home-top.png and failing!

Code:
.home-content { background-image: url(images/home-top.png), url(images/home-middle.png); background-repeat: no-repeat, repeat-y; background-position: 0px 0px, 0px 186px; width: 321px; height: 400px; }
In this example images/home-middle.png seems to start 0px from the top rather than 186px from the top.

www.burrett.net/cssissues/cssissues.html

Can you help me?
nickburrett is offline   Reply With Quote
Old 01-14-2012, 02:39 PM   PM User | #2
D34th Maker
New Coder

 
Join Date: Jan 2012
Posts: 53
Thanks: 0
Thanked 3 Times in 3 Posts
D34th Maker is an unknown quantity at this point
Quote:
Originally Posted by nickburrett View Post
Hello

I am trying to get the background image images/home-middle.png to appear 186 pixels below images/home-top.png and failing!

Code:
.home-content { background-image: url(images/home-top.png), url(images/home-middle.png); background-repeat: no-repeat, repeat-y; background-position: 0px 0px, 0px 186px; width: 321px; height: 400px; }
In this example images/home-middle.png seems to start 0px from the top rather than 186px from the top.

www.burrett.net/cssissues/cssissues.html

Can you help me?
i would suggest doing this istead cause with that it looks a bit way to messy.

CSS
Code:
.home-top {      background: no-repeat;
                 position: absolute;
                 left: 0px; top: 0px;
                }
.home-middle {       background-repeat: repeat-y;
                     position: absolute;
                     left: 0px; top: 186px;
                    }
HTML coding for the CSS only. (meaning not the whole entire html code just the part that is gonna be affected by the css)
Code:
<img src="images/home-top.png" class="home-top">
<img src="images/home-middle.png" class="home-middle">
Hope this helps and if not just say so and ill try to help you further.
D34th Maker is offline   Reply With Quote
Old 01-14-2012, 02:57 PM   PM User | #3
nickburrett
New Coder

 
Join Date: Jun 2009
Posts: 63
Thanks: 22
Thanked 0 Times in 0 Posts
nickburrett is an unknown quantity at this point
Sorry, I forgot to add... I need to add some content to the div.

Quote:
<div class="home-content">This is where the text goes!</div>
nickburrett is offline   Reply With Quote
Old 01-14-2012, 03:14 PM   PM User | #4
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
Hello nickburrett,
That seems to work fine in FF10. You know that putting two backgrounds on one element is a CSS3 thing and not widely supported? What browser are you testing in?
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Old 01-14-2012, 03:15 PM   PM User | #5
nickburrett
New Coder

 
Join Date: Jun 2009
Posts: 63
Thanks: 22
Thanked 0 Times in 0 Posts
nickburrett is an unknown quantity at this point
Safari
nickburrett is offline   Reply With Quote
Old 01-14-2012, 03:17 PM   PM User | #6
nickburrett
New Coder

 
Join Date: Jun 2009
Posts: 63
Thanks: 22
Thanked 0 Times in 0 Posts
nickburrett is an unknown quantity at this point
I've just tested in Firebox too but I am still seeing home-top behind home-middle.

If you can see any colour behind the rounded corners then it's not doing what it should be doing
nickburrett is offline   Reply With Quote
Old 01-14-2012, 03:21 PM   PM User | #7
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
Yes, even though you specify 186px down, repeating it on the y axis makes it repeat the entire height. It does not start at that 186px point and repeat down from there like you're thinking.
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Old 01-14-2012, 07:48 PM   PM User | #8
nickburrett
New Coder

 
Join Date: Jun 2009
Posts: 63
Thanks: 22
Thanked 0 Times in 0 Posts
nickburrett is an unknown quantity at this point
Can anyone suggest a workaround?
nickburrett is offline   Reply With Quote
Reply

Bookmarks

Tags
background, css, position

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 08:07 AM.


Advertisement
Log in to turn off these ads.