Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

CSS Footer Help

Featured Replies

Hey Guys,

 

I've recently created a website using CSS. The position of all elements is absolute rather than relative.

 

However this has lead to some problems with the footer on each page. As each page is a different length then I've had to create a new footer ID for each page!! Which is very long! This will need to be change everytime new content is added to the pages!

 

You can go to www.eliteclubbing.com/home.php.

 

if you click the links you'll see that I've taken some of the footers off as i've been experimenting with various techniques but with no luck!

 

I can post the code if you wish... but it can be viewed through the view source option on your browser.

 

Any ideas?!... I'd just like one ID which can be used for all pages of all lengths!

 

Thanks

The only idea I can think of is not using all absolute positions.

 

If you need your layout to follow your content you can't take it out of the content flow.

 

Absolutely positioning might seem the best choice to begin with as it allows for precise positioning, but to do what you want you need to learn how to use padding, margin, floating and relative positioning.

 

Sorry, I'm sure that's not what you wanted to hear, but I can't see any quick-fix for this.

 

Welcome to the forum, by the way.

It also might help to not have a height on your wrapper as a lot of the pages exceed this height and it really makes no sense at all to have one unless it is going to be a fixed layout which yours isn't at all...

 

Ohh well maybe it would be a good idea to get rid of all height attributes where thinks are likley to run over. as what will be happening is the footer will be placing itself in a position under where it is supposed to end (where the hieght is telling it) rather then positioning at the bottom of everything.

 

 

Height tags are only useful if you know the height the page will end up, if it could be taller then this height then that causes problems in a layout.

 

 

Also what Thomas has said :) as in your footer tag you are telling it to position 800px (or something close to that) from the top, so if your main content exceeds this then your footer will still postion itself 800px from the top and just overlay the other stuff.

There's absolutely no need for you to use absolute positioning with that layout... It's just going to make things more complicated for you.

Have you tried adding; <div style="clear:both"></div> before the footer div and after the container element?

Have you tried adding; <div style="clear:both"></div> before the footer div and after the container element?

 

 

That won't help as they are position from the top of the page so many pixels. They need to rethink how they are laying it out as it makes no sense to have it so that the information expands, but set their footer to be at a fixed position from the top. as all that means is the footer will be covering some of the main text due to this.

Have you tried adding; <div style="clear:both"></div> before the footer div and after the container element?

 

 

The clear property only affects floats.

Why not make the main content section relative and position that the same way you did with the absolute, since it's your only relative div it should just go into the same position as it would of as the absolute one. Then make your footer relative as well, and it will make it move with the different amount of content you have per page. I used a mix of relative and absolute on my old version of my portfolio http://blue42media.co.uk/craig/craigv1/contact.php and it seemed to do the trick

 

Sorry if it's explained badly i'm terrible at explaning things.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.