MozillaZine

CSS problem - div positioning

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
chickengirl

User avatar
 
Posts: 685
Joined: March 20th, 2005, 9:47 pm
Location: Illinois
April 13th, 2006, 11:06 pm

Post Posted April 13th, 2006, 11:06 pm

I've been working on a new stylesheet for my personal website, and I'm pretty happy with the layout (the colors I'm still working on) but I'm having a problem where on many pages, the space between the navlist and the body is larger than it's supposed to be (it's supposed to be 10px). I can't seem to find any rhyme or reason to which pages look the way they're supposed to and which don't -- and even on the ones that don't work, the size of the gap varies.

This is what I want it to look like:
Image

and this is one of the pages that doesn't work (this is the most obvious one):
Image

The CSS file in question is http://chickengirl.ch.funpic.org/clubcassandrapink.css

Can somebody help me figure out what is going on here?

jscher2000

User avatar
 
Posts: 8152
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA
April 14th, 2006, 12:48 am

Post Posted April 14th, 2006, 12:48 am

If I visit the page http://chickengirl.ch.funpic.org/copper.html and use the Web Developer Extension to apply your new css file as a user css file, it works. Might there be an HTML glitch in the page illustrated above?

chickengirl

User avatar
 
Posts: 685
Joined: March 20th, 2005, 9:47 pm
Location: Illinois
April 14th, 2006, 1:10 am

Post Posted April 14th, 2006, 1:10 am

I looked through the code for that page, but I couldn't find anything wrong with it, and all of my HTML validates. Do you know what kind of glitch I should be looking for?

I have the web developer extension and I tried adding the css as a user css file, but it didn't work for me. Maybe I didn't do it right?

jscher2000

User avatar
 
Posts: 8152
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA
April 14th, 2006, 11:31 am

Post Posted April 14th, 2006, 11:31 am

chickengirl wrote:I looked through the code for that page, but I couldn't find anything wrong with it, and all of my HTML validates. Do you know what kind of glitch I should be looking for?

Is there a testing folder where I could look at the page as you have it now?

chickengirl wrote:I have the web developer extension and I tried adding the css as a user css file, but it didn't work for me. Maybe I didn't do it right?

I forgot to mention an intermediate step: I saved the .css file to my desktop first... the extension doesn't allow "user templates" to be on remote servers. ;-)

chickengirl

User avatar
 
Posts: 685
Joined: March 20th, 2005, 9:47 pm
Location: Illinois
April 14th, 2006, 4:18 pm

Post Posted April 14th, 2006, 4:18 pm

jscher2000 wrote:
chickengirl wrote:I looked through the code for that page, but I couldn't find anything wrong with it, and all of my HTML validates. Do you know what kind of glitch I should be looking for?

Is there a testing folder where I could look at the page as you have it now?


The way I have it now is the way it is on the server. The only difference between my local copy and the copy on the server is the php includes.

chickengirl wrote:I have the web developer extension and I tried adding the css as a user css file, but it didn't work for me. Maybe I didn't do it right?

I forgot to mention an intermediate step: I saved the .css file to my desktop first... the extension doesn't allow "user templates" to be on remote servers. ;-)[/quote]

I used the copy that was on my hard drive. Why's it not working for me, then?

texmex
 
Posts: 403
Joined: March 26th, 2006, 8:58 am
Location: NE Lincs
April 14th, 2006, 4:24 pm

Post Posted April 14th, 2006, 4:24 pm

Chickengirl.
I downloaded your HTML page and the http://chickengirl.ch.funpic.org/clubcassandrapink.css file you specified above, and it reproduces the problem you mentioned. Now the problem, as I see it is around that main "BODY" DIV that contains the content in the main part of the page.

On the one hand you want the right hand edge to be on the far right of the document. Yet, on the ther hand you want it's left hand border to be close to your "navigation" DIV.

Unfortunately you seem to have misunderstood the purpose of the Float-right attribute. This specifies that the given element should allow content to float around it's right hand side. This is NOT what you want here. You actually want to force the BODY DIV to occupy all the space that is available to it's right. Actually this is quite easy as it is the default behaviour for a DIV tag.

If you just remove the line float: right; from your clubcassandrapink.css file, it's all sorted.

jscher2000

User avatar
 
Posts: 8152
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA
April 14th, 2006, 4:26 pm

Post Posted April 14th, 2006, 4:26 pm

chickengirl wrote:I used the copy that was on my hard drive. Why's it not working for me, then?

Could it be the old cache problem? Ctrl+Reload, or copy to new file names and try from there?

chickengirl

User avatar
 
Posts: 685
Joined: March 20th, 2005, 9:47 pm
Location: Illinois
April 14th, 2006, 9:14 pm

Post Posted April 14th, 2006, 9:14 pm

texmex wrote:If you just remove the line float: right; from your clubcassandrapink.css file, it's all sorted.


That fixed it.

Thanks!

Return to Web Development / Standards Evangelism


Who is online

Users browsing this forum: No registered users and 6 guests