?
Solved

Two DIV tags in one centred DIV tag

Posted on 2011-02-14
3
Medium Priority
?
310 Views
Last Modified: 2012-05-11
Hi all,

Using css I need to have a DIV tag with a width of 900px centred on a webpage.

Inside that tag, I need to have two other DIV tags that share the space equally, 450px each, one aligned to the left, one to the right.

Any help is appreciated.

Thanks.

resourcesys.
0
Comment
Question by:resourcesys
[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
3 Comments
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 1000 total points
ID: 34886879
try this one

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<style>
		.centerDiv
		{
			width:902px;
			height:450px;
			margin:40;
			border-width:1px;
			border-style:solid;
		}
		.leftDiv
		{
			width:450px;
			height:450px;
			background-color:pink;
			display:inline;
		}
		.rightDiv
		{
			width:450px;
			height:450px;
			background-color:blue;
			display:inline;
		}
	</style>
</HEAD>

<BODY>
	<div class="centerDiv">
		<div class="leftDiv"></div>
		<div class="rightDiv"></div>
	</div>
</BODY>
</HTML>

Open in new window

0
 
LVL 4

Assisted Solution

by:DangerousJeff
DangerousJeff earned 1000 total points
ID: 34886927
Pretty similar

<html>
<head>

<style>

#container {
	
	width: 900px;
	margin: 0 auto;

}
#leftcol {
	width: 450px;
	float: left;


}
#rightcol {
	width: 450px;
	float: left;

}
</style>
</head>
<body>

<div id="container">
<div id="leftcol">
<h1>Left side</h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut
laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation
ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure
dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla
facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit
augue duis dolore te feugait nulla facilisi.</p>
</div>
<div id="rightcol">
<h1>Right side</h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut
laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation
ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure
dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla
facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit
augue duis dolore te feugait nulla facilisi.</p>
</div>
</div>

</body>
</html>

Open in new window

0
 

Author Closing Comment

by:resourcesys
ID: 34886982
Thanks for both replies.
0

Featured Post

WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

Question has a verified solution.

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

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.
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 code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
Suggested Courses

770 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