Solved

Two DIV tags in one centred DIV tag

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

828 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