Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

div positioning

Status
Not open for further replies.

benluke4

Technical User
Jan 27, 2005
127
0
0
GB
ok i have a problem

i have a div with a div inside it. How do i get the div inside it to sit at the bottom of the other div?

Thanks

Ben
 
example:

important style definitions are in [blue]blue[/blue]

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]

<html>
<head>
<title>Untitled</title>

<style type="text/css"><!--

#main {[blue]
    position: relative;
    height: 500px;[/blue]
    width: 500px;
    border: 1px solid black;
    background-color: #333;
}

#inner {[blue]
    position: absolute;
    bottom: 0;
    height: 200px;[/blue]
    width: 400px;
    border: 1px solid red;
    background-color: #c0c0c0;
}

--></style>

</head>

<body>

<div id="main">

<div id="inner"></div>

</div>

</body>
</html>

*cLFlaVA
----------------------------
[tt]tastes great, less filling.[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
In case you missed this detail of FlaVa's answer, the DIV has to have an id (or you can skip the id and add the declaration to the div tag when you create it)

He is no fool who gives what he cannot keep to gain what he cannot lose.
- Jim Elliot
 
Hi thanks for that,

havn't got round to giving it ago yet

Thanks

Ben
 
i want to hang in with this one, how do i centeralign a div. it has been a question for me since the beginning of my code-age which wasn't too long ago :S

Thou shalt be victorious!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top