Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7
Like Tree1Likes
  • 1 Post By Ronald Roe

Thread: Floating not working??

  1. #1
    Member
    Join Date
    Sep 2011
    Location
    Vancouver,Canada
    Posts
    88
    Member #
    29393
    Liked
    2 times

    Floating not working??

    Hello guys,

    Ive been redesigning my site to a new design..Doing the coding now and its not live so I can only provide of the screenshot..

    Im using HTML 5 on the coding..But it seems that when used of floating the background suddenly dissappeared..

    Here is the sample HTML code

    HTML Code:
    <div class="container clearfix">
            <div id="content">
            <div class="one-third authImage">
            <img src="images/me.png">
            </div>
            <div class="one-half contents">
            Im a web-designer/developer and a freelancer from Vancouver. I do most programming/coding stuffs which give me more fun and challenging task. Programming is logically hard to deal with but more fun. 
            But there's nothing more fun playing games. Check out some of my previous web works and client works...
            </div>
            </div><!--content-->
            
        
    
        </div><!--content container-->
    and I just used on the css float:left and float right but the background color suddenly dissapeared..In my previous web development I have done..It didnt show like this kind of issue..It also included on footer by the way,

    Please see screenshot..

    float.jpg

    Thank you

  2.  

  3. #2
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    You need to make sure you clear your floats. When the "background color disappears", it's because the element with the background color has collapsed.
    TheGAME1264 likes this.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  4. #3
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    What Ron said. When You Float, You Must Clear.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  5. #4
    Member
    Join Date
    Sep 2011
    Location
    Vancouver,Canada
    Posts
    88
    Member #
    29393
    Liked
    2 times
    Hey, I tried that..The background shows up but the floating now doesnt work..You see on the content with the images, I need the content to be floated right and the circular image to be floated left..But after adding clear: both styles the floating for the content doesnt work unless I have to set width and add margin-top to its styles..But thats seems to be not in a good doing for coding..

    Cheers

  6. #5
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    You are probably clearing on or before the same elements you're floating. Don't do that. It won't work.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  7. #6
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Or you're clearing it outside of the elements. Clear it immediately after the last element.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  8. #7
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Just use the pseudo-element clearfix:
    Code:
    parent-element-that-collapses::after{
      clear:both;
      content:"";
      display:block;
      height:0;
      width:0;
    }
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Tags for this Thread

All times are GMT -6. The time now is 05:34 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com