1、利用Dreamweaver新建一个html页面。
2、在body里面输入代码
<ul>
<li>你好</li>
<li>小鱼</li>
<li>小小</li>
</ul>。
3、默认的样式是这样的。
4、编辑li标签的css样式。
5、float:left代表的是元素左对齐。这样li标签就可以横排显示了,list-style:none用来去除li标签前面的小圆点。
因为你用的模板,传的是一个array,每循环一次生成一个DIV,所以要把循环开始<!-- BEGIN nameArr.Name -->放在<div class = "userList">前面,改成这样========================================
html:
<div class="showUser">
<fieldset>
<legend>俱乐部成员</legend>
<!-- BEGIN nameArr.Name -->
<div class = "userList">
<p> </p>
<p><a href="./index.php?id={uid}">{userName}</a></p>
<!-- IF avatar = "" -->
<p><a href="./index.php?id={uid}" ><img src = "/team5/v0.6/upload/_static/picture/avatar/default.jpg"></a></p>
<!-- ELSE -->
<p><a href="./index.php?id={uid}" ><img src = "/team5/v0.6/upload/_static/picture/avatar/{avatar}"></a></p>
<!-- ENDIF -->
</div>
<!-- END nameArr.Name -->
</fieldset>
<div class="clear"></div>
</div>
==========================================
css:
.showUser{
width:780px
padding:10px
}
.showUser legend {
margin-bottom:20px
font-size:200%
}
.userList{
margin-bottom:5px
word-break:break-all
word-wrap:break-word
float:left
}
.userList img {
margin:5px 19.5px
border:4px solid #d7e1ed
display:block
}
.userList a {
margin:5px 19.5px
color:#444
text-decoration:none
}
.userList a:hover {
color:#888
text-decoration:none
}
===========================================
function getName()
{
global $DB,$mysql_prefix
$nameArr = array()
$con = mysql_connect("localhost", "root", "admin")
if (!$con)
{
die('Could not connect: ' . mysql_error())
}
$db_selected = mysql_select_db("micblog",$con)
$sql = "SELECT `UID`, `AVATAR`, `USERNAME` FROM `WEIQU_USERINFO`"
$result = mysql_query($sql,$con)
while($Re = mysql_fetch_array($result))
{
$nameArr[] = array(
"uid"=>strip_tags($Re['UID']),
"userName" =>strip_tags($Re['USERNAME']),
"avatar" =>strip_tags($Re['AVATAR']),
)
}
$return['Name'] = $nameArr
return $return
}