divs in the same row, but filling the row

Discussion in 'HTML' started by Francesco Moi, May 15, 2007.

  1. Hi.

    I want to place 5 divs within the same row:
    div-div-div-div-div

    My HTML:
    -------------
    <div class="content">
    <div class="fooclass"><img src="image.jpg"></div>
    <div class="fooclass"><img src="image.jpg"></div>
    <div class="fooclass"><img src="image.jpg"></div>
    <div class="fooclass"><img src="image.jpg"></div>
    <div class="fooclass"><img src="image.jpg"></div>
    <div class="fooclass"><img src="image.jpg"></div>
    </div>
    --------------

    My CSS:
    --------
    div.fooclass
    {
    float:left;
    background-color:red;
    }
    --------

    However, the divs are really floating, and I went them to fill their
    row, because I have to insert <br/> to fill this row.

    Does anybody have a solution? Thank you very much.
    Francesco Moi, May 15, 2007
    #1
    1. Advertising

  2. Francesco Moi

    John Hosking Guest

    Francesco Moi wrote:

    > I want to place 5 divs within the same row:
    > div-div-div-div-div


    > <div class="fooclass"><img src="image.jpg"></div>
    > <div class="fooclass"><img src="image.jpg"></div>
    > <div class="fooclass"><img src="image.jpg"></div>
    > <div class="fooclass"><img src="image.jpg"></div>
    > <div class="fooclass"><img src="image.jpg"></div>
    > <div class="fooclass"><img src="image.jpg"></div>


    > div.fooclass
    > {
    > float:left;
    > background-color:red;


    display:inline;
    /*presumably you have some padding and margins, too*/

    > }


    > However, the divs are really floating, and I went them to fill their
    > row, because I have to insert <br/> to fill this row.


    It won't always be five, but might be three or six, depending on the
    width of the container (viewport). But that's what you really want,
    isn't it?

    HTH
    --
    John
    John Hosking, May 15, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rich
    Replies:
    0
    Views:
    714
  2. Francesco Moi
    Replies:
    0
    Views:
    304
    Francesco Moi
    May 15, 2007
  3. maya
    Replies:
    4
    Views:
    230
  4. Mohsen Pahlevanzadeh
    Replies:
    0
    Views:
    112
    Mohsen Pahlevanzadeh
    Sep 9, 2013
  5. MRAB
    Replies:
    0
    Views:
    111
Loading...

Share This Page