div+css一些技巧 li前面插入小表徵圖置中+marquee

來源:互聯網
上載者:User

1.公告滾動。想做一個滾動的公告前面加一個小表徵圖,而且是置中的,本可以在li前面設定背景,然後padding left 但是由於 加了padding後,公告的下一列也會有padding,樣式不好看,我想還是在li裡面加個圖片吧。但是圖片又不置中。因為li的 line-height設定了。圖片這個css是沒有影響的。經過尋找。下面方法可以實現:

img{ border:solid 1px #dddddd; padding:2px;vertical-align: middle;}
    <marquee scrollamount='2' scrolldelay='2'  direction='up' onmouseover="stop()" onmouseout="start()" bgcolor="#ececec"  height="192px">

應用:

<asp:Repeater ID="rpt_gggs" runat="server">
<HeaderTemplate> <ul class="ul_marquee"></HeaderTemplate>
<ItemTemplate><li><a href="../Content.aspx?id=<%# Eval("id")%>"><img src="/village/Content/icon/notice.jpg" /><%# Eval("title")%></a></li></ItemTemplate>
<FooterTemplate> </ul></FooterTemplate>
</asp:Repeater></marquee>
</div>

好了 效果就是:

 

==================marquee在ul中使用============
css 代碼:
.ul_marquee{ margin-left:5px; display:table;}
.ul_marquee li
{
    line-height: 150%;
    width: 100%;
    text-align: left;
    font-size: 12px;
}

切記:不能這樣 不能出現float
.ul_marquee li
{
    float:left
    line-height: 150%;
    width: 100%;
    text-align: left;
    font-size: 12px;
}

---------應用----------------------------------------

<div id="main_right">
<div class="notice">
<h3><a href="#" target="_blank">公告公示</a></h3>
<div style=" width:228px; height:300px;">
     <marquee scrollamount='2' scrolldelay='2'  direction='up' onmouseover="stop()" onmouseout="start()" bgcolor="#ececec"  height="192px">
<asp:Repeater ID="rpt_gggs" runat="server">
<HeaderTemplate> <ul class="ul_marquee"></HeaderTemplate>
<ItemTemplate><li><a href="../Content.aspx?id=<%# Eval("id")%>"><img src="/village/Content/icon/notice.jpg" /><%# Eval("title")%></a></li></ItemTemplate>
<FooterTemplate> </ul></FooterTemplate>
</asp:Repeater></marquee>
</div>

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.