0

I want to make the Tags list just like this below.
I want to use CSS instead of using Table tag.
How can I do this?

Tags: Apple Banana Melon Strawberry Kiwi Orange 
      Pineapple Carrot Onion Tomato Bacon Sandwitch
      SoyBeans Pork Beef Chicken 
4

3 回答 3

3

Use display:table-cell

HTML

<div class="table">
  <div class="td">tags</div>
  <div class="td">Apple Banana Melon Strawberry Kiwi Orange Pineapple Carrot Onion Tomato Bacon Sandwitch SoyBeans Pork Beef Chicken </div>
</div>

CSS

.table{display:table-row; width:350px; }
.td:first-child{width:10px; }
.td{display:table-cell;  padding:10px; width:320px}

LIVE DEMO

于 2013-01-09T09:43:02.360 回答
1

You can do it like this:

HTML:

<div class="left">
    Tags:
</div> 
<div class="right">
    Apple Banana Melon Strawberry Kiwi Orange 
    Pineapple Carrot Onion Tomato Bacon 
    Sandwitch SoyBeans Pork Beef Chicken 
</div>

CSS:

.left, .right
{
color:#2B91AF;
}

.left
{
  float: left;
  width: 30px; //adjust this width according to your needs
  margin-right: 10px; //adjust this margin according to your needs
}

.right
{
  float: left;
  width: 400px; //adjust this width according to your needs
}

Here is a fiddle just because it's nice: http://jsfiddle.net/VQjGW/

于 2013-01-09T09:48:02.087 回答
0

For something like this I would advice using a Definition List. You can read a great article on this here: http://css-tricks.com/utilizing-the-underused-but-semantically-awesome-definition-list/

After that it should be easy enough to use css and position the elements like in your example .

于 2013-01-09T09:56:58.023 回答