PDA

View Full Version : How to align the contents of a div



bUrGe
15 Jun 2009, 01:45 PM
Hi there,

I want to have a footer on my web page, that has a horizonal UL within it and a bit of text alongside it, as below:

http://www.mnetuk.com/Clients/LBACreative/ManisInn/ForumPictures/Required.jpg

I want to center align the div like the screenshot below

http://www.mnetuk.com/Clients/LBACreative/ManisInn/ForumPictures/Actual.jpg

How can I achieve this? If I just center align the text in the div, the text to the right of the UL centers, but the UL stays to the left, as the attached screenshot shows ('actual.jpg').

Please help!

Wickham
16 Jun 2009, 02:02 AM
Your image links don't work, but as a guide you can always create a footer containing div and put two or more divs inside and float one left or center and the other float: right; then you can position the text inside any of them independently perhaps with text-align: right; for the right one.

This is code I used once:-
<div id="footer">

<div class="navfloatleft">
<p class="margin0">&copy; My Name 2007</p>
</div>

<div class="navfloatright">
<p class="margin0" style="text-align: right"><a href="#top" title="Back to top">top</a> | <a href="localpeople1.html" title="Local People 1">Prev</a> | <a href="../ancestors/ancestors1865to1900.html" title="Ancestors 1865 to 1900">Next</a>
</p>
</div>

<div>
<p class="margin0">This div will move up into the space between the left and right floated divs (if there is room) and fill the remaining width if it has no width stated.</p>
</div>

</div><!--end of #footer-->