日期:2014-05-17  浏览次数:20696 次

css 定位
我希望”时间“在左, ”回复此评论“ 在右,现在我是通过中间加空格的方法实现,用css该怎么做?

谢谢


 <div >
            <br />
            <span >时间。。。</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                <a  href="########">回复此评论</a></div>



------解决方案--------------------
span {
display: block;
}

span.leftSide {
float:left;
}

span.rightSide {
float: right;
}

给俩span加上对应的class
------解决方案--------------------
一个左浮动 一个右浮动 不就ok了
------解决方案--------------------
不考虑低端浏览器

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    
    <style type="text/css">

        div.test {
            outline:1px solid #ccc;
        }

            div.test > div:first-child {
                background-color:#eee;
            }

            div.test > div:last-child {
                overflow:hidden;
                background-color:#eee;
            }

            div.test span:first-child {
                color:#fc0;
                float:left;
            }

            div.test span:last-child {
                color:#f00;
    &nbs