我正在使用 jquery li scroll plugin在我创建新闻自动收报机的网站上,这个 jqueryli 滚动插件需要你的新闻在 <li>
中标签和这个插件对我来说工作正常,但问题是我想在新闻行情之前放置文本。
我想要像 NEWS FEED : actual news
这样的输出
目前我已经实现了“实际新闻”,当我尝试将 NEWS FEED 标签放在自动收报机前面时,它出现了我的问题。
问题是,当我将 NEWS FEED 标签放在代码前面时,代码新闻会转到下一行,然后我输出为:
NEWS FEED :
"actual news "
我用过代码:
<div>NEWS FEED
<ul id="ticker01">
<?php foreach ($news_array as $single_news) : ?>
<li><span><?php echo $single_news; ?><span></li>
<?php endforeach; ?>
</ul>
<div>
如何在单行中实现 NEWS FEED 标签和新闻行情?
我已经按如下方式编辑了 css:
.tickercontainer { /* the outer div with the black border */
width: 850px;
height: 32px;
margin-left: 100px;
padding: 0;
overflow: hidden;
}
.tickercontainer .mask { /* that serves as a mask. so you get a sort of padding both left and right */
position: relative;
left: 10px;
top: 8px;
width: 718px;
}
ul.newsticker { /* that's your list */
position: relative;
left: 750px;
font: bold 10px Verdana;
list-style-type: none;
margin: 0;
padding: 0;
}
ul.newsticker li {
float: left; /* important: display inline gives incorrect results when you check for elem's width */
margin: 0;
padding: 0;
background: #fff;
}
ul.newsticker a {
white-space: nowrap;
padding: 0;
color: #ff0000;
font: bold 10px Verdana;
margin: 0 50px 0 0;
}
ul.newsticker span {
white-space: nowrap;
padding: 0;
font-family: "Times New Roman";
font-size: 16px;
color: #ff0000;
margin: 0 50px 0 0;
}
/* liScroll styles */
这是问题 fiddle :click here
最佳答案
好的。
作品:http://jsfiddle.net/p6akP/2/
#outerdiv{
float:left;
width:1000px;
}
.tickercontainer { /* the outer div with the black border */
width: 850px;
height: 32px;
float:right;
padding: 0;
overflow: hidden;
}
.tickercontainer .mask {
top:0;
//other styling you have
}
<div id="outerdiv">NEWS FEED
<ul id="ticker01">
<li><span>10/10/2007</span><a href="#">The first thing ...</a></li>
<li><span>10/10/2007</span><a href="#">End up doing is ...</a></li>
<li><span>10/10/2007</span><a href="#">The code that you ...</a></li>
</ul>
<div>
关于jquery - 如何使 ul 之前的文本在 html 中以单行显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20106575/