网络编程
位置:首页>> 网络编程>> 网页设计>> 通过定位控制信息列表下往上的增加

通过定位控制信息列表下往上的增加

作者:林小志 来源:林小志blog 发布时间:2008-06-30 14:27:00 

标签:定位,列表,css

 在一个页面制作过程,突然被设计稿上的一个问题难住了,思路一时没打开,后来在费人的提醒下,用定位控制,顺利完成。

这个是我做的大概的示意图,主要的功能就是文字那块,如果再增加一行,比如发布日期:2008-6-4,那就要底部对齐向上增加。所以前期如果用margin或者padding制作了一个效果,后期修改很麻烦,而改用定位就不同了。

xhtml结构:

 程序代码

<div class="product">
    <img src="images/product.jpg" alt="" />
    <div class="proInfo">
        <dl>
            <dt>产品名称:</dt>
            <dd>软件名称</dd>
            <dt>版 本 号:</dt>
            <dd>5.8.1.507</dd>
            <dt>软件大小:</dt>
            <dd>7.38MB</dd>
            <dt>发布日期:</dt>
            <dd>2008.05.27</dd>
        </dl>
        <div class="btns"><a href="#" title="官方下载">官方下载</a></div>
    </div>
</div>

CSS样式:


* {margin:0;padding:0;}
body {font:normal 12px/1.5em Verdana,Lucida, Arial, Helvetica, "宋体",sans-serif;}
.product {width:520px;height:auto;overflow:hidden;zoom:1;margin:10px auto;}
.product img {float:left;width:220px;height:140px;border:1px solid #AECFDF;}
.proInfo {float:right;width:250px;height:150px;position:relative;}
.proInfo dl {width:250px;height:auto;overflow:hidden;zoom:1;position:absolute;bottom:40px;right:0;}
.proInfo dl dt, .proInfo dl dd {float:left;width:60px;height:20px;line-height:20px;color:#484848;}
.proInfo dl dd {width:190px;}
.btns {width:250px;height:40px;position:absolute;bottom:-9px;right:0;}
.btns a {float:left;display:block;width:76px;height:35px;margin-right:10px;}

为了方便测试,可以修改内容再运行一下



 

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com