Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Positioning in html/css

Posted on 2011-02-18
4
Medium Priority
?
266 Views
Last Modified: 2012-05-11
hi

in css i have a division tag that can vary in size(accepts input dynamically).

now i want the outside division tag to also expand according to the inner division tag.

for example:

<div id="body">
<div id="content1"></div>
<div id="content2"></div>
</div>





now if the height of the content1 division tag expands(by giving height as auto) i want content2 to go down according to the height of content1 and also the body division tag to expand according to the height of content1.


Thanks in advance.
0
Comment
Question by:manikandan689
[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
  • 2
4 Comments
 

Author Comment

by:manikandan689
ID: 34927088
Problem in positioning of html-css
0
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 2000 total points
ID: 34927304
try this

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<style>
		#body
		{
			min-height:100px;
			height:auto;
			width:200px;
		}
		#content1, #content2
		{
			min-height:50px;
			height:auto;
			border:1px solid red;
			width:200px;
		}
	</style>
</HEAD>

<BODY>
	<div id="body">
		<div id="content1">
			Content 1 <br>
			Content 1 <br>
			Content 1 <br>
		</div>
		<div id="content2">
			Content 2
		</div>
	</div>
</BODY>
</HTML>

Open in new window

0
 

Author Comment

by:manikandan689
ID: 34928281
hi

i need to position the content1 from top 50px(from body division tag)
 and content 2 from bottom 0px(from body division tag)
and do the previously mentioned functionalities

i.e
if the height of the content1 division tag expands(by giving height as auto) i want content2 to go down according to the height of content1 and also the body division tag to expand according to the height of content1.
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 34928338
then try this
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<style>
		#body
		{
			min-height:100px;
			height:auto;
			width:200px;
		}
		#content1
		{
			min-height:50px;
			height:auto;
			border:1px solid red;
			width:200px;
			position:absolute;
			top:50px;
		}
		#content2
		{
			position:absolute;
			height:auto;
			bottom:0px;
			border:1px solid red;
			width:200px;
		}
	</style>
</HEAD>

<BODY>
	<div id="body">
		<div id="content1">
			Content 1 <br>
			Content 1 <br>
			Content 1 <br>
		</div>
		<div id="content2">
			Content 2
		</div>
	</div>
</BODY>
</HTML>

Open in new window

0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

721 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