Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Background Image Positioning
Old 12-30-2011, 05:41 AM Background Image Positioning
vultren's Avatar
Webmaster Talker

Posts: 583
Name: Tony
Location: Seattle Washington
Trades: 1
Hi All,

Usually I don't run into problems, but I absolutely cannot figure this out. I haven't actually ever run into this styling issue...

Here is an illustration of what I want:



My issue is the background image. I cannot get it to stay static on at that position when a user changes the screen size small or bigger.

It needs to stay at the bottom left pulled out a bit away from the container.

Here is the code:

Code:
<body>
<div class="bg">
	<div class="container">
        
        container contents
        
        
	<!--end container--></div>
    
    <div class="footerbg">
	<div class="footer_container">

footer contents

    <!--end footer_container--></div>
<!--end footerbg--></div>


<!--end bg--></div>
</body>


Code:
body
{
	background-color:#FFF;
	background-image:url(img/bg.jpg);
	background-repeat:repeat-x;
	height:773px;
	font-family:Arial, Helvetica, sans-serif;
	
}


.bg
{	background-image:url(img/globe.png);
	background-repeat:no-repeat;
	overflow:hidden;
	background-position:bottom left;
	background-attachment:fixed;

	
}

.container
{
	margin:0 auto;
	height:100%;
	width:930px;
	
}
I am also using 2 background images, that's why I had to make the .bg. I know there is CSS3 for this, but I can't even figure this out. What I marked up is completely wrong I know

Any help would be greatly appreciated!
__________________

Please login or register to view this content. Registration is FREE

I am here to give advice as well as learn.

Please login or register to view this content. Registration is FREE
.
vultren is online now
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-30-2011, 07:08 AM Re: Background Image Positioning
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Remove the "fixed" value.

It works in a similar way that position: fixed works, where "fixed" is actually relative to the viewport.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-30-2011, 10:45 PM Re: Background Image Positioning
vultren's Avatar
Webmaster Talker

Posts: 583
Name: Tony
Location: Seattle Washington
Trades: 1
Quote:
Originally Posted by chrishirst View Post
Remove the "fixed" value.

It works in a similar way that position: fixed works, where "fixed" is actually relative to the viewport.
Ok just tried it. Doesn't work how I wasn't it to.

Lets say you make the browser window smaller... the background just stays the same and doesn't move with the container... the overflow hidden also removes the scrolling box for very small window browsers which is an issue of it's own also.

It needs to act like one very large webpage but have a hidden value for the background if a screen is smaller in size. Imagine background-position:center bottom; - see how that scales and moves with the site when resized? I need that but justified a bit more over to the right like in the picture above.
__________________

Please login or register to view this content. Registration is FREE

I am here to give advice as well as learn.

Please login or register to view this content. Registration is FREE
.

Last edited by vultren; 12-30-2011 at 10:50 PM..
vultren is online now
Reply With Quote
View Public Profile
 
Old 12-30-2011, 10:58 PM Re: Background Image Positioning
vultren's Avatar
Webmaster Talker

Posts: 583
Name: Tony
Location: Seattle Washington
Trades: 1
Edit: I fixed it with:
background-position:center bottom;
and made the image a lot longer on the x axis. Is this the correct way of doing this?

The overflow hidden is kind of messing up the scroll bar when the browser goes less then 930px (my set width for the container).
__________________

Please login or register to view this content. Registration is FREE

I am here to give advice as well as learn.

Please login or register to view this content. Registration is FREE
.
vultren is online now
Reply With Quote
View Public Profile
 
Old 12-31-2011, 04:41 AM Re: Background Image Positioning
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
There is seldomly a "correct" way of doing things. Since you got it to work, it can be concidered correct.

When designing websites you can't make everyone happy. The issue of screen resolution and window resizing is just like using different OS or browsers, you can't make it perfect in all cases. With a width of 930px your website will probably look the way you meant for it to look for 99% of your users, and the remaining 1% who have a smaller screen resolution is likely aware and already used to that they'll need to scroll horizontally on some pages.
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
lizciz is online now
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 12-31-2011, 03:02 PM Re: Background Image Positioning
vultren's Avatar
Webmaster Talker

Posts: 583
Name: Tony
Location: Seattle Washington
Trades: 1
Quote:
Originally Posted by lizciz View Post
There is seldomly a "correct" way of doing things. Since you got it to work, it can be concidered correct.

When designing websites you can't make everyone happy. The issue of screen resolution and window resizing is just like using different OS or browsers, you can't make it perfect in all cases. With a width of 930px your website will probably look the way you meant for it to look for 99% of your users, and the remaining 1% who have a smaller screen resolution is likely aware and already used to that they'll need to scroll horizontally on some pages.
Exactly what I figured. You are definitely correct. Thanks for the input!
__________________

Please login or register to view this content. Registration is FREE

I am here to give advice as well as learn.

Please login or register to view this content. Registration is FREE
.
vultren is online now
Reply With Quote
View Public Profile
 
Reply     « Reply to Background Image Positioning
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.64256 seconds with 12 queries