difficulty with a float left and right layout

This is a discussion on "difficulty with a float left and right layout" within the Web Page Design section. This forum, and the thread "difficulty with a float left and right layout are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 9th, 2007, 21:00
konnor5092's Avatar
SuperMember

SuperMember
Join Date: Feb 2007
Location: Norwich, UK
Age: 23
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
difficulty with a float left and right layout

Bonjourno,

I have this layout in which elements are floated left and right on the page, and im encountering some difficulties.

The first is a problem ive experienced before but can't remember a way round it. Firefox isn't displaying the background colour, despite the div containing the elements having a background colour specified...

Code: Select all
<div id="maincontent">
    <h2 class="aboutpic">About the web devise team</h2>
    <h2 class="aboutmatt">Matt O'Connor</h2>
    <h2 class="aboutjames">James Bailey</h2>
    <div id="profilecontainer"> 
        <div id="mattprofile">
            <p>Age: 22</p>
            <p>Occupation: Software Consultant</p>
            <p>Qualifications: BSc Computer Science with Imaging and multimedia, UEA</p>
        </div>
        <div id="jamesprofile">
            <p>Age: 22</p>
            <p>Occupation: Software Consultant</p>
            <p>Qualifications: BSc Computer Science with Imaging and multimedia, UEA</p>
        </div>
     </div>
</div>
Code: Select all
#maincontent {
    width: 701px;
    background-color: #413d3e;
}
The site can be viewed at http://www.themissingpeace.co.uk/about.php

The next issue is that when I add padding inside the floated left and right content boxes using <p>, the whole page shifts left, despite all the elements being inline. This can be demonstrated by switching between 'home' and 'about' in the nav bar.

Code: Select all
p {padding-left: 5px; padding-right: 5px;}
Quote:
#profilecontainer {
clear: both;
width: 701px;
}

#mattprofile, #jamesprofile {
width: 336px;
padding-top: 80px;
}

#mattprofile {
background: #000000 url(images/mattgraphic.jpg) top left no-repeat;
float: left;
}

#jamesprofile {
background: #000000 url(images/jamesgraphic.jpg) top left no-repeat;
float: right;
}
Thanks in advance,

Matt
Reply With Quote

  #2 (permalink)  
Old Aug 9th, 2007, 21:05
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 21
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: difficulty with a float left and right layout

It's because the float property removes those elements it is applied to from the flow of the document. I think its overflow:auto; that solves it though that could be wrong. Add it to the container div and it should (might) work.

Pete.
Reply With Quote
  #3 (permalink)  
Old Aug 9th, 2007, 21:17
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: difficulty with a float left and right layout

yes, add overflow: hidden;
to the maincontent div.

I don't see the padding problem.
Reply With Quote
  #4 (permalink)  
Old Aug 9th, 2007, 21:33
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 21
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: difficulty with a float left and right layout

Not auto then.

Woops.

Pete.
Reply With Quote
  #5 (permalink)  
Old Aug 9th, 2007, 21:38
konnor5092's Avatar
SuperMember

SuperMember
Join Date: Feb 2007
Location: Norwich, UK
Age: 23
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Re: difficulty with a float left and right layout

In firefox the whole 'about' page shifts to the left when compared with the 'home' page.

that overflow seems to have done the trick, ta.

*EDIT problem seems to have sorted itself out. Funny how that happens....

code and div wise, does this look like a 'clean' way of acheiving the look I'm after? Possible to remove the 'profilecontainer' per chance?

many thanks

Last edited by konnor5092; Aug 9th, 2007 at 21:42.
Reply With Quote
  #6 (permalink)  
Old Aug 9th, 2007, 22:16
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: difficulty with a float left and right layout

I do think you can delete the profilecontainer div. That one did seem extra.

Otherwise, it was logical ...That's how I would do it too.
Reply With Quote
  #7 (permalink)  
Old Aug 9th, 2007, 22:30
konnor5092's Avatar
SuperMember

SuperMember
Join Date: Feb 2007
Location: Norwich, UK
Age: 23
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Re: difficulty with a float left and right layout

IE doesn't seem to like it removed unfortunately.

Still got this shifting problem in FF. Don't spose anyone else has noticed it?
Reply With Quote
  #8 (permalink)  
Old Aug 10th, 2007, 00:51
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: difficulty with a float left and right layout

But IE if fine with the div? Then if that's the case, put it back. I'd need to look again but it's late. I'll give it a go tomorrow.
Reply With Quote
  #9 (permalink)  
Old Aug 10th, 2007, 02:02
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: difficulty with a float left and right layout

Maybe I can't see the problem but I've refreshed and refreshed and I don't see any problems in shifting in any browser and I don't see anything wrong with the two div's that are floating.

Maybe someone else can test this?
Reply With Quote
  #10 (permalink)  
Old Aug 10th, 2007, 07:01
konnor5092's Avatar
SuperMember

SuperMember
Join Date: Feb 2007
Location: Norwich, UK
Age: 23
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Re: difficulty with a float left and right layout

very strange. If I change the resolution on my monitor, it no longer happens! I'll leave it be. Can't be a code problem.

Thanks for taking the time to have gander.

*EDIT - Oh I am a silly sausage! It was because when the content becomes more than a page in height, it adds the scroll bar down the right hand side of the browser, so everything is shifted left and recentred to accomodate.

Last edited by konnor5092; Aug 10th, 2007 at 15:57.
Reply With Quote
Reply

Tags
colour, float, ieff

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Difficulty with HTML E-mail... TheLion Web Page Design 3 Jan 24th, 2008 20:50
Float: Left with firefox magnetica Web Page Design 2 Aug 24th, 2007 16:55
help useing float building page right to left rocket468 Web Page Design 5 Jan 23rd, 2007 23:56
Problems with float:left float:right nvidiajoe Web Page Design 8 Nov 17th, 2006 20:24
Difficulty understanding Contact Form henryd Introduce Yourself 3 Oct 8th, 2005 02:53


All times are GMT. The time now is 03:49.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43