By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,973 Members | 1,854 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,973 IT Pros & Developers. It's quick & easy.

Position of <p> inside <div>

nathj
Expert 100+
P: 938
Hi All,

I'm working on a new site that has a two column layout underneath a title bar. If you check out:
http://www.christianleadership.org.u...h/mainpage.php
using IE or Opera you will see what I am after as these browsers work fine.

However, in FF the results are slightly different - take a look and you'll see that the <p>, within <div class="mainContent"> has shot way over to the right.

I've been working on this for 2days now and I'm getting more and more frustrated by the second.

Does anyone know why the layout would behave like this?

The code is simple:

[html]
<!-- style sheets included above this -->
<div class="pageContainer">
<b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>
<div class="topBannerContainer"></div>
<div class="leftSideBar">
<p>
This will contain the menus.
</p>
<p>
The menu displayed here will be dependant on the user profile.
</p>
</div>
<div class="mainContent">
<p>
This will contain the controls that allow the data to be created, viewed and edited. The data being manipulated is determined by the menu item selected.
</p>
</div>
</div>
[/html]

Expand|Select|Wrap|Line Numbers
  1. /* General Document Format */ 
  2. html, body, ul, ol, li, p, blockquote, q,
  3. h1, h2, h3, h4, h5, h6, fieldset, legend,
  4. form, label, a, div, img, dd, dt, dl, input, span, img
  5. {
  6.     margin                : 0px;
  7.     padding                : 0px;
  8.     border                : 0px;
  9. }
  10.  
  11. body
  12. {    
  13.     font-family            : verdana, "trebuchet MS", helvetica, sans-serif;
  14.     font-size            : 11px; 
  15.     line-height            : 1.637; 
  16.     margin                : 0px 0px;
  17.     padding                : 0px;
  18.     height                : 100%;    
  19.     text-align            : center ; 
  20. }                            
  21.  
  22. /* Containers */
  23. div.pageContainer                         
  24. {
  25.     width                : 765px ;
  26.     margin-left            : auto ;
  27.     margin-right        : auto ;
  28.     margin-top            : 15px ;   
  29.     overflow            : auto ;
  30. }
  31.  
  32.     div.topBannerContainer
  33.     {
  34.         position            : relative ;
  35.         margin-left            : 0px ;
  36.         margin-right        : 0px ;
  37.         width                : 765px ;
  38.         height                : 125px ;
  39.         background-image    : url("../image/ResponseTrackerLogo.png") ;
  40.         background-repeat    : no-repeat ;    
  41.     }
  42.  
  43.     div.leftSideBar
  44.     {
  45.         position            : relative ; 
  46.         float                : left ;
  47.         margin-left            : 0px ;
  48.         margin-right        : 0px ;    
  49.         padding                : 0px ;
  50.         left                : 2px ;     
  51.         width                : 180px ;
  52.         text-align            : left ; 
  53.         border                : solid 1px ;
  54.     }
  55.  
  56.         div.leftSideBar p
  57.         {
  58.             padding                : 0px ;
  59.             margin                : 0px 2px 5px 2px ;
  60.         }
  61.  
  62.     div.mainContent
  63.     {                               
  64.         position            : relative ;
  65.         margin-left            : 0px ;
  66.         margin-right        : 0px ;      
  67.         padding             : 0px ;
  68.         left                : 200px ;
  69.         width                : 560px ;
  70.         text-align            : left ; 
  71.         border                : solid 1px ;         
  72.     }
  73.  
  74.         div.mainContent p
  75.         {
  76.             padding                : 0px ;
  77.             margin                : 0px 5px 7px 2px ;
  78.             text-align            : left ;
  79.         }
  80.  
  81.  
All help gratefully received.

Cheers
nathj
Oct 30 '07 #1
Share this Question
Share on Google+
5 Replies


nathj
Expert 100+
P: 938
Hi All,

I have resolved this issue so I thought I'd post back the solution.

On the div mainContent I removed the left: 200px and added float: right then on the div leftSideBar I added float: left and all is now well on IE, FF and O.

Thanks
Nathan
Oct 30 '07 #2

drhowarddrfine
Expert 5K+
P: 7,435
That gets around the issue but the problem was actually displaying a bug in IE. Your link is down so ...........
Oct 31 '07 #3

nathj
Expert 100+
P: 938
That gets around the issue but the problem was actually displaying a bug in IE. Your link is down so ...........
The link is now:
www.response-tracker.co.uk/mainpage.php and it's working again.

The bug in IE was also manifest in Opera as that displayed the same behaviour. The solution I have (outlined previously) works a treat.

Thanks for stopping by.
nathj
Nov 1 '07 #4

drhowarddrfine
Expert 5K+
P: 7,435
You are in 'quirks mode' and will continue to have problems until this is corrected. You cannot have anything before the doctype. This triggers the problem and all browsers will be unpredictable.

Also, you have 53 html errors.
Nov 2 '07 #5

nathj
Expert 100+
P: 938
You are in 'quirks mode' and will continue to have problems until this is corrected. You cannot have anything before the doctype. This triggers the problem and all browsers will be unpredictable.

Also, you have 53 html errors.
Thank you for this. The site is now fine in terms of errors and the DOCType is positioned correctly. I think you must have seen the site in the middleof some changes. Anyway as you would have been able to tell from the site it is currently in the very early stages of development.

Thank you for your input it is appreciated.
nathj
Nov 9 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.