如何创建这个css? [英] how to create this css?
本文介绍了如何创建这个css?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须遵循divs:
< div id =cont>
< div class =row>
< div class =col> 1< / div>
< div class =col> example.com< / div>
< div class =col> text1< / div>
< div class =col>< b> text1< / b>< / div>
< / div>
< div class =row>
< div class =col> 2< / div>
< div class =col> example2.com< / div>
< div class =col> text2< / div>
< div class =col>< b> text2< / b>< / div>
< / div>
< / div>
我想了解如何写这个表的css。
我认为 class =col
需要float:left(因为每个div必须是连续的, / p>
写 class =row
?
strong> EDIT:我不想要一个表,我写了表,因为我需要同样的想法:
< table>
< tr>
< td>< / td>
< td>< / td>
< td>< / td>
< / tr>
< tr>
< td>< / td>
< td>< / td>
< td>< / td>
< / tr>
< / table>
但我只需要使用div。
解决方案
我认为你的CSS应该是:
.row {
display:block;
}
.col {
display:inline-block;
width:200px; / *例如* /
}
I have to follow divs:
<div id="cont">
<div class="row">
<div class="col">1</div>
<div class="col">example.com</div>
<div class="col">text1</div>
<div class="col"><b>text1</b></div>
</div>
<div class="row">
<div class="col">2</div>
<div class="col">example2.com</div>
<div class="col">text2</div>
<div class="col"><b>text2</b></div>
</div>
</div>
I would like to understand how to write the css for this "table".
i think class="col"
needs float:left (becase each div must to be consecutive, horizontally), but how to
write class="row"
?
EDIT: I don't want a table, I wrote "table" because I need the same think of:
<table>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
but I need to do that only using divs.
解决方案
I think your css should be:
.row{
display:block;
}
.col{
display:inline-block;
width:200px;/*for example*/
}
这篇关于如何创建这个css?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文