Problems with CSS positioning

SpaceshipSpaceship
Watch

neilorourke

Established Member
Impact
0
Hi all

I'm quite new to the principle of using CSS rather than tables for page layout so I'm probably missing something obvious here.

In both IE and firefox all the elements on http://www.teachban-artgallery.com/ are visable when the browser window is maximised. If the user reduces the size of the window they are unable to scroll to the top of the page as the header is truncated.

Please could someone advise me on as a way around this.

Thanks
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains — AI StorefrontUnstoppable Domains — AI Storefront
Just looked at it and even with the maximum screen size the header is truncated in Safari, FF and Opera.

I looked at your source code and noticed you are using frames... Any particular reason for this? If not, drop the frame and place your page in a div container with absolute positioning and place all page elements inside this container using relative positioning. That should work.

best of luck
 
1
•••
I haven't used frames on this website. I changed the DIV elements within the page DIV container to relative positioning but this did not have any impact on the original issue.

Is there anything else which could be causing this?

Thanks for your time

Neil
 
0
•••
show me the CSS for the #logo div.
 
0
•••
/* centre all elements*/
#centering-div {
position: absolute;
width: 770px;
height: 870px;
left: 50%;
top: 45%;
margin-left: -385px;
margin-top: -435px;
}

<body>
<div id="centering-div">

That is your problem.

You have a top margin of negative 435.
 
0
•••
yeah, using negative margins is a hack.
 
0
•••
Thanks for looking into this. I suspected this may be related to the negetive top margin.

This was recommended as a way of centering all content in the page. Do you know of any way of centering content without this problem occuring?

Cheers
 
0
•••
centreing content is easy:

body{
text-align:center;
}

then in your #contatiner (or equivalent):

#container{
margin:0px auto;
}

works a treat!
 
0
•••
I'm with albino 100%...

#centering-div {
position: absolute;
width: 770px;
margin: 25px auto 0;
}

Because your content isn't a fixed height, I'd drop the vertical centering attempt altogether and simply set my left and right margins to auto, and the top margin to give the header a little space.

A breakdown of the margin:
-- 25px - From the top - to give the header a little breathing room, adjust it however you'd like.
-- Auto (left and right) - Is telling it to set the left and right margins equally, which will center it horizontally.
-- 0 - Just an unset bottom margin.

The only way, I believe, to use the previous hack and not run into problems with things disappearing - would be to set a minimum height/width, but I'm pretty sure IE ignores them, so the majority of your visitors will run into problems regardless.

G'luck.
 
1
•••
there is a hack for ie min height, just put

_height:min height here;

weird, but it works.
 
0
•••
Hi

I tried this but this threw the content over to the left. I have set a test page and css file so you can see what happens. This can be found at http://www.galleries-online.co.uk/teacban/indextest.cfmhttp://www.galleries-online.co.uk/teacban/indextest.cfm.

I remember trying these latest suggestions before but they did not work which led me to trying the negative values.

Please note if you do have a look at the above URL please use IE as I have not made any changes to the mozilla version of the css
 
Last edited:
0
•••
My bad, overlooked position, try...

#centering-div {
position: relative;
width: 770px;
margin: 25px auto 0;
}
 
0
•••
Thanks, that's done most of trick although the footer now dissappears from the bottom! Not a big problem, I have other issues but will post them an other time to give you guys a break!

I've switched the changes over to the live version at http://www.galleries-online.co.uk/teacban/index.cfm


cheers

Neil
 
Last edited:
0
•••

We're social

Spaceship
Domain Recover
CatchDoms
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back