Can I convert a <ul> into a <table> with a pre-specified number of columns?

gmaletic
avatar
rank newbie

newbie


Posts: 5
Joined: 2007-10-16

I want to display an array of customer logos on our web site. Even though I want the data displayed two-dimensionally, strictly speaking, this isn't 2-dimensional data. It would seem like a

    is the most appropriate way to display these logos.

    Yet the logos are all different sizes, and when I display them as a list using display:inline, they don't line up vertically. Is this a case where I should use tables, even though I don't want to? (I get frustrated with all the excessive s.)

    Even if I use something like display: table-cell to avoid all of the s, another problem crops up: I want the table to be of a particular dimension (say, 3 columns wide), and I don't know how to specify that. Is there a way to do so?

    Thanks.

gmaletic
gmaletic's picture
rank newbie

newbie


Posts: 5
Joined: 2007-10-16

Correction to previous post

Sorry for the confusion: I used some tags in my post that screw up the formatting. Here's how it should read:

I want to display an array of customer logos on our web site. Even though I want the data displayed two-dimensionally, strictly speaking, this isn't 2-dimensional data. It would seem like a ul tag is the most appropriate way to display these logos.

Yet the logos are all different sizes, and when I display them as a list using display:inline, they don't line up vertically. Is this a case where I should use tables, even though I don't want to? (I get frustrated with all the excessive trs and tds.)

Even if I use something like display: table-cell to avoid all of the trs and tds, another problem crops up: I want the table to be of a particular dimension (say, 3 columns wide), and I don't know how to specify that. Is there a way to do so?

Thanks.

Caposoft
Caposoft's picture
rank Enthusiast

Enthusiast


Posts: 222
Joined: 2008-03-16

I would work with an ul in

I would work with an ul in this case, defining a height and width on li. I am lacking experience and I am too lazy to try, but a margin: auto auto; should center them all. Other solution would be creating images with the same dimensions, and if it is just adding white space. But I don't know how many logos you have. Eye-wink

Ed Seedhouse
Ed Seedhouse's picture
rank Guru

Guru


Posts: 2431
Joined: 2005-12-14
Location: Victoria British Columbia

If you want things to align

If you want things to align they all have to be the same size, fairly obviously. I wouldn't use display:inline; I would use float:left; and I would put an explicit size on the LI elements that's large enough to contain the biggest logo.

I could change my plea to guilty,
but I don't think it would stick.

Ed Seedhouse