Solved

Positioning in html/css

Posted on 2011-02-18
4
256 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:
gurvinder372 earned 500 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:gurvinder372
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Link not working 6 42
Need to add another Column in Powershell script output 2 33
SVG and IE11 2 18
Html using "Or" in condition 3 27
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
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 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 …
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)

733 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