473,324 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

align div at the bottom of another div

194 100+
hi everybody,

i want to align a div at the bottom but inside the div. here is the code:

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>
  6. <style type="text/css">
  7. <!--
  8. #header {
  9.     background-color: #006;
  10.     width: 780px;
  11.     margin-top: 0px;
  12.     margin-right: auto;
  13.     margin-bottom: 0px;
  14.     margin-left: auto;
  15.     height: 200px;
  16. }
  17. #navbars {
  18.     background-color: #999;
  19.     height: 50px;
  20.     width: 450px;
  21.     overflow: auto;
  22. }
  23. -->
  24. </style>
  25. </head>
  26.  
  27. <body>
  28. <div id="header">
  29.   <div id="navbars"></div>
  30. </div>
  31.  
  32. </body>
  33. </html>
  34.  
The div wit the id "navbars" needs to be aligned at the center bottom inside the div bottom header. please tell me how i can do this using css.

thanx
Apr 29 '09 #1
2 45218
use position:relative for Heder id and position:absolute for navbars.
the code will be as ffollow:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
#header {
background-color:#000066;
height:200px;
margin:0 auto;
position:relative;
width:780px;
}
#navbars {
background-color:#999999;
bottom:0;
height:50px;
overflow:auto;
position:absolute;
width:450px;
}
-->
</style>
</head>

<body>
<div id="header">
<div id="navbars"></div>
</div>

</body>
</html>
May 6 '09 #2
Using the below code i achieved the alignment.
Check this page

#wrapper {
width: 960px;
height: auto;
margin-top: 0;
margin-right: auto;
margin-bottom: 50px;
margin-left: auto;
background-color: #e0ddd6;
position: relative;

}


#footer {

width: 960px;
height: auto;
color: #49423f;
margin-bottom: 0px;

}
Jun 11 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Markus Ernst | last post by:
Hi I have a strange problem with vertical-align. The case can be viewed at http://www.brainput.info/geschichte.html. HTML code: <div id="bild"><img src="geschichte.gif" width="274"...
6
by: TJ | last post by:
I've got a calendar that is based on the concept of lots of blocks that are spans with float:left. I would like to be able to have a detail section on the right side of the screen, so that when...
2
by: Newry | last post by:
Hi, I'm trying to position something with CSS, to have the equivalent of: <table> <tr> <td><img src="foo.jgp"></td> <td valign=bottom>Label</td> </tr> </table>
2
by: Thomas Scheiderich | last post by:
Is there a way to make a section of a <td> tag to go to the bottom of the cell? Below is a portion of my page. The <td class="BodyText"> tag has a "vertical-align:top" in the css file to move...
6
by: tshad | last post by:
I have a cell with 2 items in it: a textbox and a link. The link is actually a button (image), but for the example I am using a link, which is doing the same thing. Here is the stripped down...
7
by: ridergroov | last post by:
Hi folks. I'm trying to figure out how I can insert 2 different graphics into a table cell and align one to the top and one to the bottom using CSS. I used the "vertical align" to "top" in DW but...
0
by: laredotornado | last post by:
Hello, I'm trying to write TABLE-free HTML pages, but I'm having a problem with rewriting a particular block of code using DIVs and CSS. I want to align the "More" button at the bottom right of...
19
roula
by: roula | last post by:
I HATE DIVS AND DIFFERENT BROWSERS!!! i spent the whole day and night searching for a way to center align stupid divs, the problem is that the code is so sensitive, i lost my mind trying to make them...
40
by: maya | last post by:
hi, how do I get text to vertical-align inside a div? http://www.mayacove.com/misc/home.html vertical-align should work, according to this:...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.