Solved

How to get footer on bottom?

Posted on 2011-09-08
4
174 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

724 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