Putting two p or div tags horizontally aligned on same plane

Reply

Join Date: Feb 2007
Posts: 72
Reputation: adaykin is an unknown quantity at this point 
Solved Threads: 0
adaykin adaykin is offline Offline
Junior Poster in Training

Putting two p or div tags horizontally aligned on same plane

 
0
  #1
May 29th, 2008
Hello, I need to put two <p> or <div> tags right next to each other so horizontally they line up with each other.

So it would like something like:
HTML and CSS Syntax (Toggle Plain Text)
  1. <p>Text</p><p>More Text</p>
  2. <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 <dt> tag too.
My Website <-- check out my site!
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 12,036
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 130
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: Putting two p or div tags horizontally aligned on same plane

 
0
  #2
May 29th, 2008
<div style="display:inline">
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/daniweb
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 48
Reputation: ardeezstyle is an unknown quantity at this point 
Solved Threads: 1
ardeezstyle ardeezstyle is offline Offline
Light Poster

Re: Putting two p or div tags horizontally aligned on same plane

 
1
  #3
May 29th, 2008
Actually it is not possible with <p> tag but u can do the same thing with <div> tag. What u need to do is give margin style to both the <div> tags and mention the width for each of the <div> tags.. Hope it will work.
Rupam Datta
ardeezstyle@gmail.com
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 72
Reputation: adaykin is an unknown quantity at this point 
Solved Threads: 0
adaykin adaykin is offline Offline
Junior Poster in Training

Re: Putting two p or div tags horizontally aligned on same plane

 
0
  #4
May 29th, 2008
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.
My Website <-- check out my site!
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 72
Reputation: adaykin is an unknown quantity at this point 
Solved Threads: 0
adaykin adaykin is offline Offline
Junior Poster in Training

Re: Putting two p or div tags horizontally aligned on same plane

 
0
  #5
May 29th, 2008
oh we posted around the same time, didn't see your response, but that is working thanks!
My Website <-- check out my site!
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 1
Reputation: chris832 is an unknown quantity at this point 
Solved Threads: 0
chris832 chris832 is offline Offline
Newbie Poster

Re: Putting two p or div tags horizontally aligned on same plane

 
0
  #6
Aug 10th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,315
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 161
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: Putting two p or div tags horizontally aligned on same plane

 
0
  #7
Aug 10th, 2009
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <!-- @(#) $Id$ -->
  4. <head>
  5. <title>bal bla</title>
  6. <style type='text/css'>
  7. .left { width: 39%; float:left; test-align:left; display:inline; }
  8. .right { width: 39%; float:right; text-align:left; display:inline; }
  9. .container { width: 80%; margin:auto;}
  10. </style>
  11. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
  12. <meta http-equiv="pragma" content="no-cache" />
  13. <meta http-equiv="cache-control" content="no-cache" />
  14. </head>
  15. <body>
  16. <div class='container'>
  17. <div class='left'>this is left</div>
  18. <div class='right'>this is not left</div>
  19. </div>
  20. </body>
  21. </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
Last edited by almostbob; Aug 10th, 2009 at 10:29 pm.
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC