Solved

How to get footer on bottom?

Posted on 2011-09-08
4
168 Views
Last Modified: 2012-05-12
In the code snippet, how do I get the footer on the bottom of the page and centered?

Also, how do I get everything to stay in the middle of the page, except the footer, which will expand all the way across?
<html>
<head></head>
<body>
<div>top div here</div>

<div style="float:left;text-align:center;width:200;height:200px;border:1px solid black;padding:10px;margin:10px;">box 1</div>
<div style="float:left;text-align:center;width:200;height:200px;border:1px solid black;padding:10px;margin:10px;">box 2</div>
<div style="float:left;text-align:center;width:200;height:200px;border:1px solid black;padding:10px;margin:10px;">box 3</div>



	<div id="footer" style="position:relative;">
		a footer here
	</div>
</body>
</html>

Open in new window

0
Comment
Question by:brettr
  • 2
4 Comments
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 36508009
<html>
	<head>
	</head>
	<body>
		<table height="100%" border="1" width="100%">
			<tr>
				<td align="center">
					<div>top div here</div>
				</td>
			</tr>
			<tr>
				<td align="center">
					<table border="1">
						<tr>
							<td><div style="BORDER-RIGHT:black 1px solid;PADDING-RIGHT:10px;BORDER-TOP:black 1px solid;PADDING-LEFT:10px;FLOAT:left;PADDING-BOTTOM:10px;MARGIN:10px;BORDER-LEFT:black 1px solid;WIDTH:200px;PADDING-TOP:10px;BORDER-BOTTOM:black 1px solid;HEIGHT:200px;TEXT-ALIGN:center">box 
									1</div>
							</td>
							<td><div style="BORDER-RIGHT:black 1px solid;PADDING-RIGHT:10px;BORDER-TOP:black 1px solid;PADDING-LEFT:10px;FLOAT:left;PADDING-BOTTOM:10px;MARGIN:10px;BORDER-LEFT:black 1px solid;WIDTH:200px;PADDING-TOP:10px;BORDER-BOTTOM:black 1px solid;HEIGHT:200px;TEXT-ALIGN:center">box 
									2</div>
							</td>
							<td><div style="BORDER-RIGHT:black 1px solid;PADDING-RIGHT:10px;BORDER-TOP:black 1px solid;PADDING-LEFT:10px;FLOAT:left;PADDING-BOTTOM:10px;MARGIN:10px;BORDER-LEFT:black 1px solid;WIDTH:200px;PADDING-TOP:10px;BORDER-BOTTOM:black 1px solid;HEIGHT:200px;TEXT-ALIGN:center">box 
									3</div>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<div id="footer" style="POSITION:relative">
						a footer here
					</div>
				</td>
			</tr>
		</table>
	</body>
</html>

Open in new window

0
 

Author Comment

by:brettr
ID: 36508093
Thanks but I'm not interested in tables.
0
 

Author Comment

by:brettr
ID: 36508103
I think the code below might be all I need for the footer part at least.
<div id="footer" style="clear:both;">

Open in new window

0
 
LVL 16

Accepted Solution

by:
HagayMandel earned 500 total points
ID: 36509120
<div id="footer" style="clear:both; width:90%; margin-left:auto; margin-right:auto;">

Open in new window

Change the width to fit your need (in px or %)
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now