Solved

Two DIV tags in one centred DIV tag

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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

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.
Find out what you should include to make the best professional email signature for your organization.
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…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

690 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