Positioning Content at the bottom of a column

Posted by (JavaScript must be enabled to view this email address) on Tue 07 Oct 2008

Say you have two columns, a left and a right column. The left column is to be the navigation are and the right column the content. This is standard for most web sites.

What happens when you want to add a footer to the left column? for example your contact details? sure you could add lots of padding and margins etc but that would break your accessibility. I had a customer that wanted this exact feature in SharePoint 2007 recently.

To be able to have two columns you have to have three divs, the container then the left and right columns.

To maintain accessibility standards and have a screenreader be able to see the navigation, then the content, then the footer you need to do something a bit more sneaky than just pad the navigation.

create your html as below


[code lang=HTML]
<div id=“Container”>
<div id=“LeftNav”>...</div>
<div id=“Content”>...</div>
<div id=“LeftFooter”>...</div>
</div>

Now that you have the html you can style it using CSS.

  1. #Container
  2. {
  3. height: auto;
  4. width: 150em;
  5. margin: auto;
  6. clear: both;
  7. position: relative; /* you will see the importance of this shortly*/
  8. }
  9. #LeftNav
  10. {
  11. width: 35em;
  12. float: left;
  13. }
  14. #Content
  15. {
  16. width: 115em;
  17. float: right;
  18. }
  19. #LeftFooter
  20. {
  21. position: absolute;
  22. left: 1em;
  23. bottom: 1em;
  24. width: 13em;
  25. }

By setting the position of the container div to relative, you are then able to override any of its child containers using absolute values RELATIVE to the bounds of the container. This means that the left footer will always be at the bottom left (with a 1em margin) of its parent.

Your Comments

Post a Comment

Name

Email Address

Website

Remember my personal information

Notify me of follow-up comments?

Please enter the word you see in the image below:


← Back to Blog Homepage

About our Blog

Brantas Limited specialise in Dynamics CRM, SharePoint and System Integration using the Microsoft Platform. We are all experienced developers in various fields with our own specialities complementing those of our team.

We have been working with SharePoint since 2003, including Installation and Administration, Migration, Development and Support.

Related Solutions

    No Related Posts Found

Related Case Studies

    No Related Posts Found