DIV+CSS,如何实现两列显示?

用DEDECMS建了一个分类信息网,就是无法实现两列显示。
在DEDECMS官方上问了半个月无一位同志愿意回答,郁闷了。。。。
实在没办法,就跑来这里求高手们解答了。谢谢
<table class="wr tlp4" id=tl cellSpacing=0 width="100%" border=0>
<tr>{dede:arclistsg row='30' col='2' titlelen='36'}</tr>
<td><IMG src="/img/ico.gif" align=absMiddle> <SPAN class=f14><a href="[field:arcurl/]" target="_blank" class="title"><B>[field:title/]</B></a><BR/>
联系人:<font color=#008826>[field:linkman/]</font> 电话:<font color=#008826>[field:tel/]</font> <BR />
地址: <font color=#008826> [field:address/]</font> <BR/>
</SPAN></td> {/dede:arclistsg}</tr>
</table>
没有一个可行的答案啊???大家有没有用过dedecms这个程序的。。没用过的就不要回答了。根据不知所云。

第1个回答  推荐于2018-04-04

DIV+CSS,实现两列显示,我们只需要写好3个div,一个总的div包裹着其他的2个,然后在分别设置好他们宽高,在使用一个margin让他们有个间隔,margin 的用法,如图:

最好是在加一个border便于我们观察,具体看代码:

<html>

<head>

<style>

#div1{                    

width:600px;

height:200px;

font-size:13px;

}

#div1 .img{

width:600px;

height:200px;

}

#div1 .wenzi{

width:600px;

height:200px;

margin-top:10px;

}

</head>

<body>

<div id='div1'>

<div class='img'>

<p>测试文字1</p>

</div>

<div class='wenzi'>

<p>测试文字2</p>

</div>

</div>

</body>

</html>

本回答被网友采纳
第2个回答  2010-08-26
每小块设置宽度,宽度是区域的一半。
然后float:left
第3个回答  2010-08-26
这个很简单,浮动就可以了,比如:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
.main{ width:800px; height:100px; font-size:12px;}
.left{ width:390px; height:100px; float:left; border:dashed 1px #FF0000}
.right{ width:390px; height:100px; margin-left:8px; float:left;border:dashed 1px #FF0000}
</style>
</head>

<body>
<div class="main">
<div class="left">我是左边</div>
<div class="right">我是右边</div>

</div>
</body>
</html>

一个简单的列子。

我补充一点,你要什么样子的2列左右的?上下的?
第4个回答  2010-08-26
float: left/right;
第5个回答  2010-08-26
<div style="width=200px;" class=main><div>左列</div><div>右列</div></div>
<style>
.main div{float:left;widht:49%;}
</style>
相似回答