使用DIV+CSS布局遇到的问题,新闻列表的标题和时间分开

html-css017

使用DIV+CSS布局遇到的问题,新闻列表的标题和时间分开,第1张

您好,您可以这么做 ;

<div>

<ul>

<li><span>2012-03-30</span>问题简单解决了,对吧!</li>

</ul>

</div>

如上面所写,把span标签里面放前面,然后float:right,这样就可以了!

试试看吧!!

这个一般是由后端的模板来实现的,纯粹靠css的话,据我个人对css的了解,是行不通的。勉强要实现的话,可以通过display:flex布局来实现,不知道效果合不合你的要求。

<style>

.flexbox{overflow:hiddendisplay:flexpadding:10pxwidth:300pxbackground-color:pink}

.flexbox h3{margin:0white-space:nowrap}

.flexbox span{flex:1padding:0 5px}

</style>

<div class="flexbox">

<h3>这个是标题这个是标题这个是</h3><span class="">...............</span>

</div>

css加上这句话试试:

html, body, ul, li, ol, dl, dd, dt, p, h1, h2, h3, h4, h5, h6, form, fieldset, legend, img { margin:0padding:0}