Jump to content

Recommended Posts

Hi all,

 

I have a design that calls for me to list all the items - image thumbnails in this case -  that I retrieve from the database into 3 columns.

 

I can achieve that using float: left; but that makes putting anything below the list difficult. I need a better way of doing it.

 

My site is here: http://adamsherman.com.au/postureperfection/chairs/ (please note it is under construction!!)

 

and here is the css:

 

.productthumb{

padding: 10px;

margin: 10px;

width: 170px;

height: 190px;

float:left;

text-align:center;

}

 

Should I be using <ul> and <li> instead of individual divs?

 

Any help would be appreciated! Thanks!

IMO I would use <ul> and <li> tags instead, since this is essentially a giant list.

 

However, for the float issue, you can use a clearfix (sort of a hack, but it works well.) My favorite implementation is over at http://stackoverflow.com/a/211467/398516

IMO I would use <ul> and <li> tags instead, since this is essentially a giant list.

 

However, for the float issue, you can use a clearfix (sort of a hack, but it works well.) My favorite implementation is over at http://stackoverflow.com/a/211467/398516

you can also use the "width, overflow" hack.

  • 2 weeks later...

<ul>

  <li>Item one</li>

  <li>Item two</li>

  <li>Item three</li>

  <li>Item four</li>

  <li>Item five</li>

  <li>Item six</li>

  <li>Item seven</li>

  <li>Item eight</li>

  <li>Item nine</li>

  <li>Item ten</li>

  <li>Item eleven</li>

  <li>Item twelve</li>

</ul>

And here's the CSS that turns that standardlist into multiple columns:

 

ul {

    width: 700px;

    list-style-type:none;

}

li {

    width:180px;

    margin:15px 0 0 0;

    padding:0 10px 0 0;

    line-height:15px;

    float:left;

}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.