954,604 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Putting two p or div tags horizontally aligned on same plane

Hello, I need to put two or


tags right next to each other so horizontally they line up with each other.

So it would like something like:

<p>Text</p><p>More Text</p>
<div>Text</div><div>More Text</p>


But I want them to be on the same plane horizontally. How would I do this? I Can't use a table because my space is limited and tables don't work well in other browsers. They have to line up in a tag too.

adaykin
Junior Poster in Training
73 posts since Feb 2007
Reputation Points: 10
Solved Threads: 0
 

<div style="display:inline">

cscgal
The Queen of DaniWeb
Administrator
19,437 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 231
 

Actually it is not possible with tag but u can do the same thing with


tag. What u need to do is give margin style to both the tags and mention the width for each of the tags.. Hope it will work.

ardeezstyle
Light Poster
49 posts since May 2008
Reputation Points: 13
Solved Threads: 1
 

is there anyway I can then add spacing to them? I want them to be on the same plane which that does, but I also want them to be aligned to the left and right, but when I tried using the align property it didn't seem to do anything.

adaykin
Junior Poster in Training
73 posts since Feb 2007
Reputation Points: 10
Solved Threads: 0
 

oh we posted around the same time, didn't see your response, but that is working thanks!

adaykin
Junior Poster in Training
73 posts since Feb 2007
Reputation Points: 10
Solved Threads: 0
 

i have a question about putting these two div boxes next to each other. lets say i make a div called container and make it 800 px wide.
then i make the two boxes that sit next to each other and make them 400px wide each. am i doing something wrong or does both padding and margin affect if they both fit next to each other? i could see margin throwing it off but isn't padding inside the box? thanks in advance 4 any replies

chris832
Newbie Poster
1 post since Aug 2009
Reputation Points: 10
Solved Threads: 0
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- @(#) $Id$ -->
<head>
<title>bal bla</title>
<style type='text/css'>
.left { width: 39%; float:left; test-align:left; display:inline; }
.right { width: 39%; float:right; text-align:left; display:inline; }
.container { width: 80%; margin:auto;}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
</head>
<body>
<div class='container'>
<div class='left'>this is left</div>
<div class='right'>this is not left</div>
</div>
</body>
</html>

The outer container div serves to keep the two inner divs aligned if one has 1000 lines of text, and one does not,
fixed pixel widths fail/ get scroll bars on less than fullscreen windows, W3C reccommends em % as element sizes,

display: inline; seems to fix IE bugs

almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You