css 横排 实现代码

建站知识 2021-07-03 08:42www.168986.cn长沙网站建设

效果预览:

 
css:

复制代码
代码如下:

<style type="text/css">
<!--
.table_tile{
text-align:left;
height: 20px;
width: 25%;
float: left;
}
.table_tile_{
text-align:right;
background-color:#0000FF;
height: 20px;
background-color:#999966;
width: 25%;
float: left;
}
.table_tile_bottom{
text-align:left;
background-color:#FFF000;
height: 20px;
width: 25%;
float: left;
}
-->
</style>

html:

复制代码
代码如下:

<div class="table_tr">
<div class="table_tile">0</div>
<div class="table_tile_">1</div>
<div class="table_tile">2</div>
<div class="table_tile">3</div>
</div>
<div class="table_tr">
<div class="table_tile_bottom">bottom0</div>
<div class="table_tile_bottom">bottom1</div>
<div class="table_tile_bottom">bottom2</div>
<div class="table_tile_bottom">bottom3</div>
</div>

或者来个更简单的:

复制代码
代码如下:

<style>
.float_left{
text-align:left;
height: 20px;
width: 25%;
float: left;
}
</style>
<div class = "float_left">asdasd</div>
<div class = "float_left">asdasd</div>
<div class = "float_left">why</div>

Copyright © 2016-2025 www.168986.cn 狼蚁网络 版权所有 Power by