Solved

Two DIV tags in one centred DIV tag

Posted on 2011-02-14
3
308 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 250 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 250 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

Independent Software Vendors: 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
Technology Resume 7 88
CSS style formatting? 2 60
Merge two Google Chrome Bookmark files or convert Excel list into an HTML file 3 73
Display Flex does not Wrap Items 2 46
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
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…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

732 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