覆盖SharePoint的square.gif和setrect.gif

时间:2010-05-12 20:33:59

标签: css sharepoint sharepoint-2007

在SharePoint 2007网站集的自定义品牌中,我需要更改项目符号图像。 SharePoint 2007使用表格和图像,而不是使用<li>标记,如下所示:

<tr>
    <td class="ms-vb" style="padding-bottom: 5px;"><img alt="" src="/_layouts/images/square.gif">&nbsp;</td>
    <td class="ms-vb" style="padding-bottom: 5px; padding-left: 5px;">
        <a href="http://stackoverflow.com" onfocus="OnLink(this)">stackoverflow</a>
    </td>
</tr>

<tr>
    <td width="8px" valign="top" nowrap style="padding-top: 5px;" class="ms-descriptiontext">
        <img width="5px" height="5px" alt="" src="/_layouts/images/setrect.gif">&nbsp;
    </td>
    <td valign="top" style="padding-top: 7px; padding-left: 3px;" class="ms-descriptiontext">
        <a href="/_layouts/people.aspx" id="ctl00_PlaceHolderMain_UsersAndPermissions_RptControls_PeopleAndGroups">People and groups</a>
    </td>
</tr>

我唯一的选择是CSS。目标浏览器是Quirks模式下的IE8。我不能:

  1. 更改OOTB图像,布局页面或Links schema.xml
  2. 更改母版页或HTML以添加DOCTYPE或元标记
  3. 使用Javascript
  4. 我尝试了以下CSS,但似乎忽略了填充:

    td.ms-descriptiontext img,
    td.ms-vb img
    {
        background:transparent url("/_layouts/images/myproject/bullet.gif") no-repeat top left;
        height:5px;
        padding-right:5px;
        width:0;
    }
    

    有什么想法吗?

3 个答案:

答案 0 :(得分:0)

尝试:

td.ms-descriptiontext img,
td.ms-vb img
{
    background:transparent url("/_layouts/images/myproject/bullet.gif") no-repeat top left;
    display: block;
    height: 0;
    padding: 5px 5px 0 0;
}

答案 1 :(得分:0)

尝试使用margin而不是padding?

答案 2 :(得分:0)

我做了一个解决方法javascript:寻找img标签并替换它们的来源:

  <script language="javascript" type="text/javascript">
var arrElements = document.getElementsByTagName("img");
for (var i=0; i<arrElements.length; i++) {
        //get pointer each image element:
        var element=arrElements[i];
        //check for a source with /images/square.gif from this site:
        if (element.getAttribute('src') == "http://www.MY-SITE-NAME.com/_layouts/images/square.gif") {
            //found... change it's src to our new image:
            element.setAttribute('src', 'http://www.MY-SITE-NAME.com/MY-LOCATION/MY-CUSTOM-BULLET.gif');
        }
    }