1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: CSS Float Not Working

Discussion in 'Web Design & Development' started by MMJ, Jan 19, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. MMJ

    MMJ Guest Thread Starter

    Joined:
    Oct 15, 2006
    Messages:
    3,625
    I want three images to be lined up next to each other without using a table.

    <img class="leftfloat" src="image.jpg" />
    <img class="rightfloat" src="image.jpg" />
    <img class="rightfloat" src="image.jpg" />

    CSS:

    .rightfloat
    {
    float:right;
    }

    .leftfloat
    {
    float:left;
    }

    =====

    The images just line up under each other.

    So what am I doing wrong? Is there a simpler way to do this?
     
  2. namenotfound

    namenotfound

    Joined:
    Apr 30, 2005
    Messages:
    3,012
    Who said they had to be in a table to be next to eachother? They don't

    [​IMG]
     
  3. MMJ

    MMJ Guest Thread Starter

    Joined:
    Oct 15, 2006
    Messages:
    3,625
    This is embarrassing. I'll look into it.
     
  4. MMJ

    MMJ Guest Thread Starter

    Joined:
    Oct 15, 2006
    Messages:
    3,625
    Ok, it seems like clear:both; was disabling it. Thanks a bunch. :)
     
  5. MMJ

    MMJ Guest Thread Starter

    Joined:
    Oct 15, 2006
    Messages:
    3,625
    Ok, how do I center three images next to each other?

    <div align="center"> isn't working for me. :(

    ---

    Some other CSS must be clashing with it.

    Edit:
    Yeah, that was the problem.

    ===========

    Is there a way to increase the space between images without increasing the padding?
     
  6. Eriksrocks

    Eriksrocks

    Joined:
    Aug 7, 2005
    Messages:
    2,183
    Increase the margins. :)
     
  7. Eriksrocks

    Eriksrocks

    Joined:
    Aug 7, 2005
    Messages:
    2,183
    Padding is inside the block, like for a text DIV, margins are outside the block. :)
     
  8. MMJ

    MMJ Guest Thread Starter

    Joined:
    Oct 15, 2006
    Messages:
    3,625
    Thanks. :)
     
  9. MMJ

    MMJ Guest Thread Starter

    Joined:
    Oct 15, 2006
    Messages:
    3,625
    How can I center an image using css?
     
  10. Eriksrocks

    Eriksrocks

    Joined:
    Aug 7, 2005
    Messages:
    2,183
    style="margin-left: auto; margin-right: auto;" :)

    That tells your browser to set the margins so that they are both equal and so the thing is centered. :)
     
  11. MMJ

    MMJ Guest Thread Starter

    Joined:
    Oct 15, 2006
    Messages:
    3,625
    Ok, thanks. :)
     
  12. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/536621

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice