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-27-2012, 10:39 PM   PM User | #1
TechBiteReviews
New Coder

 
Join Date: May 2012
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
TechBiteReviews is an unknown quantity at this point
Question Fixing a background image in place with CSS-HTML

Hi,
I have a website i am currently making and i am wondering if there is a way to fix the background in the same position all the time even when the windows is re-sized, the issue i am having is that my background is a small striped repeat background at roughly 400px width and height, making the whole background. my navigation buttons on the top also fade out from the stripes to black. The problem is that I can make the buttons line up with the background, but when the window is re-sized the buttons and the background are no longer lined up.

Is there any way to keep it fixed in place with HTML or CSS, preferable CSS?

Thanks to anyone who can help in advanced!
TechBiteReviews is offline   Reply With Quote
Old 05-27-2012, 11:38 PM   PM User | #2
badwolf
New Coder

 
Join Date: Nov 2010
Location: Virginia,USA
Posts: 36
Thanks: 1
Thanked 7 Times in 7 Posts
badwolf is an unknown quantity at this point
Have you tried something like this yet? Open your stylesheet and add the bits in red to your background rule;

Code:
  background: #FFF url(images/yourimage.png) top center fixed;

Last edited by badwolf; 05-27-2012 at 11:41 PM..
badwolf is offline   Reply With Quote
Users who have thanked badwolf for this post:
TechBiteReviews (05-27-2012)
Old 05-27-2012, 11:59 PM   PM User | #3
TechBiteReviews
New Coder

 
Join Date: May 2012
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
TechBiteReviews is an unknown quantity at this point
Smile

Quote:
Originally Posted by badwolf View Post
Have you tried something like this yet? Open your stylesheet and add the bits in red to your background rule;

Code:
  background: #FFF url(images/yourimage.png) top center fixed;
Same problem but i thanked you anyways
TechBiteReviews is offline   Reply With Quote
Old 05-28-2012, 12:26 AM   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 TechBiteReviews,
If using badwolfs suggestion doesn't work, maybe you are fixing the background in the wrong place. If it needs to match your navigation buttons then your background probably needs to be part of whatever element your menu is contained by so they will move relative to each other.

Hard to say without seeing the test site.
__________________
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 05-28-2012, 12:39 AM   PM User | #5
TechBiteReviews
New Coder

 
Join Date: May 2012
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
TechBiteReviews is an unknown quantity at this point
Quote:
Originally Posted by Excavator View Post
Hello TechBiteReviews,
If using badwolfs suggestion doesn't work, maybe you are fixing the background in the wrong place. If it needs to match your navigation buttons then your background probably needs to be part of whatever element your menu is contained by so they will move relative to each other.

Hard to say without seeing the test site.
Hi Excavator, I currently dont have a server yet as i was planning on buying one once the website is complete. and there is many files to show. basically i have just got the background image set on the body tag of css.

Thanks
TechBiteReviews is offline   Reply With Quote
Old 05-28-2012, 01:05 PM   PM User | #6
Major Payne
Regular Coder

 
Join Date: Aug 2005
Location: MS
Posts: 745
Thanks: 7
Thanked 65 Times in 63 Posts
Major Payne is an unknown quantity at this point
100% Background Image might work:

http://www.cssplay.co.uk/layouts/background.html

bgStretcher jQuery Plugin Allows to Add Background Image to Page and Proportionally Resize it to Fill Entire Window Area: http://www.ajaxblender.com/bgstretch...nd-plugin.html
__________________
☠ ☠RON☠ ☠
Major Payne is offline   Reply With Quote
Old 05-29-2012, 07:17 PM   PM User | #7
TechBiteReviews
New Coder

 
Join Date: May 2012
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
TechBiteReviews is an unknown quantity at this point
Quote:
Originally Posted by Major Payne View Post
100% Background Image might work:

http://www.cssplay.co.uk/layouts/background.html

bgStretcher jQuery Plugin Allows to Add Background Image to Page and Proportionally Resize it to Fill Entire Window Area: http://www.ajaxblender.com/bgstretch...nd-plugin.html
Hi, unfortunately this would not work either the image has to stay the same size, but as it is a small image i have it on repeat so it fills the page and saves loading time. heres a picture of it not lining up after a mouse rollover:


I hope there is a solution because i really like the design i tried a plain gradient color of blue and it looks no where near as good.

Thanks!

Last edited by TechBiteReviews; 05-29-2012 at 11:40 PM..
TechBiteReviews 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 10:19 PM.


Advertisement
Log in to turn off these ads.