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
Unusual BG centering in Safari... Help!
Old 12-18-2008, 05:15 PM Unusual BG centering in Safari... Help!
Auroch's Avatar
Novice Talker

Posts: 5
Name: Brian
Location: Utah
Trades: 0
So I've been putting together my new site layout, and since I cannot find a feasible way to make a div vertically extend the full height of a variable length window, I have added the following to give the impression that the div with the same background fills the page.

body {
margin: 0 auto;
background-image: url(images/tk_main_bg.jpg);
background-repeat:repeat-y;
background-position:center; /*--I've also tried 50% here, to no avail--*/

While this looks great in every other browser I have tried, Safari offsets the background by several pixels, ruining the illusion of fluidity. See here:
http://www.taokore.com/images/screen_01.png
or view the link below in Safari.

Notice how on the bottom left the background is shifted to the right underneath the content div. For an example of how it should look, view this page in FF, IE, or Opera:
http://www.taokore.com/config.php

Any suggestions? :P
Auroch is offline
Reply With Quote
View Public Profile Visit Auroch's homepage!
 
 
Register now for full access!
Old 12-18-2008, 11:28 PM Re: Unusual BG centering in Safari... Help!
stevej's Avatar
Professional Multitasker

Posts: 996
Location: Not positive
Trades: 0
Pretty simple, actually. All you need to do is put some more padding, or margin, in the safari version. I got this code off of a website, so no doubt you could take a lot of it out.

JavaScript
Code:
<script type="text/javascript">

var css_browser_selector = function() {var ua=navigator.userAgent.toLowerCase(),is=function(t){return ua.indexOf(t) != -1;},h=document.getElementsByTagName('html')[0],b=(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?'gecko ff2':is('firefox/3')?'gecko ff3':is('gecko/')?'gecko':is('opera/9')?'opera opera9':/opera\s(\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('chrome')?'chrome webkit safari':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';var c=b+os+' js'; h.className += h.className?' '+c:c;}();

</script>
CSS
Code:
/*this is how it is normally */
#detection { 
height: 20px; 
background: #8C8C8C;
}
/*this is the special version */
.safari #detection {
height: 400px;
}
And, of course, the html code:

HTML Code:
<p id="detection">
Detect this.
</p>
Hope it helps!
- Steve

Last edited by stevej; 12-18-2008 at 11:32 PM..
stevej is offline
Reply With Quote
View Public Profile
 
Old 12-19-2008, 10:23 AM Re: Unusual BG centering in Safari... Help!
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
You need to get rid of all that positioning, nested position:absolutes is just ASKING for trouble - and it's utterly unnecessary.

Use the normal document flow with floats and margins to get things where you want them. Check the stickies for methods to achieve 100% height, and check out the faux columns method (which you've sort of implemented already).
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

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


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

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 12-21-2008, 03:04 PM Re: Unusual BG centering in Safari... Help!
Auroch's Avatar
Novice Talker

Posts: 5
Name: Brian
Location: Utah
Trades: 0
Thanks for the feedback. I would like to avoid having to use java, as this seems unnecessary, but I will consider it as a last alternative. I have also already tried to use float and make things naturally flow, without much success, but I will do some more research and see what I can do. That seems to make the most sense to me as well, despite my failed efforts. Thanks again!
Auroch is offline
Reply With Quote
View Public Profile Visit Auroch's homepage!
 
Reply     « Reply to Unusual BG centering in Safari... Help!
 

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.14107 seconds with 12 queries