1

我知道有 1000 篇关于此类问题的文章,但它们似乎并没有解决我的问题。我正在开发一个在我到达这家公司之前创建的网站,他们基本上有一个占位符来向网站添加“小部件”。当用户单击“添加小部件”时,它会显示它们的滚动列表。在 IE5(Quirks 模式)中,它以某种方式与小部件完美配合,但之后的任何东西都不起作用。它可以很好地显示“AddWidgetContainer” div,但不能显示里面的 div 元素。这是代码。没有外部 css,因为他们内联地做所有事情,因为每个用户的图像都不同。我已经测试过了,图像可用,一切都通过服务器,但不显示;

<div style="margin-left:10px; height:78px; min-height:78px;" id="AddWidgetContainer">

                                <div id="addaccstats" class="WidgetPanel" style="width:190; height:78; display:none; float:left; background:url(/applications/images/widgets/add/account-statistics.png); background-repeat:no-repeat;">
                                    <a class="AddWidgetAddButton" href="#" onClick="addWidget('accstats')"></a>
                                </div>

                                <div id="addacct_wiz" class="WidgetPanel" style="width:190; height:78; display:none; float:left; background:url(/applications/images/widgets/add/account_wizard.png); background-repeat:no-repeat;">
                                    <a class="AddWidgetAddButton" href="#" onClick="addWidget('acct_wiz')"></a>
                                </div>

                                <div id="addalerts" class="WidgetPanel" style="width:190; height:78; display:none; float:left; background:url(/applications/images/widgets/add/Alerts.png); background-repeat:no-repeat;">
                                    <a class="AddWidgetAddButton" href="#" onClick="addWidget('alerts')"></a>
                                </div>

                                <div id="addassets" class="WidgetPanel viewable" style="width:190; height:78;  display:inline; float:left; background:url(/applications/images/widgets/add/assets_under_mgmt.png); background-repeat:no-repeat;">
                                    <a class="AddWidgetAddButton " href="#" onClick="addWidget('assets')"></a>
                                </div>

                                <div id="addbiz_snap" class="WidgetPanel viewable" style="width:190; height:78;  display:inline; float:left; background:url(/applications/images/widgets/add/biz_snapshot.png); background-repeat:no-repeat;">
                                    <a class="AddWidgetAddButton" href="#" onclick="addWidget('biz_snap')"></a>
                                </div>

                                <div id="addcomm_snap" class="WidgetPanel viewable" style="width:190; height:78;  display:inline; float:left; background:url(/applications/images/widgets/add/commissions_snapshot.png); background-repeat:no-repeat;">
                                    <a class="AddWidgetAddButton" href="#" onclick="addWidget('comm_snap')"></a>
                                </div>

                                <div id="addevents" class="WidgetPanel viewable " style="width:190; height:78;  display:inline; float:left; background:url(/applications/images/widgets/add/conferences_events.png); background-repeat:no-repeat;">
                                    <a class="AddWidgetAddButton" href="#" onclick="addWidget('events')"></a>
                                </div>
                                <div id="addcalc" class="WidgetPanel viewable " style="width:190; height:78;  display:inline; float:left; background:url(/applications/images/widgets/add/tools_calculators.png); background-repeat:no-repeat;">
                                    <a class="AddWidgetAddButton " href="#" onClick="addWidget('calc')" ></a>
                                </div>
                                <div id="addcrm" class="WidgetPanel viewable " style="width:190; height:78;  display:inline; float:left; background:url(/applications/images/widgets/add/crm.png); background-repeat:no-repeat;">
                                                                                                                                                                                                                                    <a class="AddWidgetAddButton" href="#" onclick="addWidget('crm')"></a>
                                </div>

                                <div id="addcrmcal" class="WidgetPanel viewable " style="width:190; height:78;  display:inline; float:left; background:url(/applications/images/widgets/add/calendar.png); background-repeat:no-repeat;">
                                                                                                                                                                                                                                    <a class="AddWidgetAddButton" href="#" onclick="addWidget('crmcal')"></a>
                                </div>

                                <div id="adddocs" class="WidgetPanel" style="width:190; height:78;  display:none; float:left; background:url(/applications/images/widgets/add/Documents.png); background-repeat:no-repeat;">
                                                                                                                                                                                                    <a class="AddWidgetAddButton" href="#" onClick="addWidget('docs')"></a>
                                </div>

                                <div id="addecbr" class="WidgetPanel viewable" style=" width:190; height:78;  display:inline; float:left; background:url(/applications/images/widgets/add/ecbr.png); background-repeat:no-repeat;">
                                                                    <a class="AddWidgetAddButton" href="#" onClick="addWidget('ecbr')"></a>
                                </div>

                                <div id="addfollow" class="WidgetPanel" style="width:190; height:78;  display:none; float:left; background:url(/applications/images/widgets/add/Follow_up_required.png); background-repeat:no-repeat;">
                                                                                                                                                                                                                                    <a class="AddWidgetAddButton " href="#" onClick="addWidget('follow')"></a>
                                </div>

                                <div id="addforms" class="WidgetPanel viewable" style="width:190; height:78;  display:inline; float:left; background:url(/applications/images/widgets/add/forms.png); background-repeat:no-repeat;">
                                                                                                                                                                                                                                    <a class="AddWidgetAddButton" href="#" onClick="addWidget('forms')"></a>
                                </div>

                                <div id="addholidays" class="WidgetPanel viewable" style="width:190; height:78;  display:inline; float:left; background:url(/applications/images/widgets/add/holidays_events.png); background-repeat:no-repeat;">
                                                                                                                                                                                                                                    <a class="AddWidgetAddButton" href="#" onClick="addWidget('holidays')"></a>
                                </div>  

                                <table border="0" class="AddWidgetButtonContainer" style="display:inline; float:left; line-height:30px; vertical-align:middle; margin:0; width:950px; height:30px; padding:0;">
                                    <tr><td><a id="ctl00_ContentPlaceHolder1_lnkWidgetAddReset"  class="AddWidgetButtonContainerButton" href="COMMunityLink.asp">Reset to default home page</a></td>
                                    <td style="text-align:right; float:right; vertical-align:middle;  margin:0px; width:200px; height:30px; "  id="addWidgetCounter"></td>
                                    <td id="paging_buttons" style="width:75px" ><a id="widget_prev" style="background: url('/applications/images/icons/btn_widget_prev.gif') no-repeat; padding:10 12 10 12; width=20px; height:20px; background-position:right" href="#" onClick="prevels();return false"></a>
                                    &#160;
                                    <a id="widget_next" href="#" style="background: url('/applications/images/icons/btn_widget_next.gif') no-repeat; padding:10 12 10 12; width=20px; height:20px; background-position:right" onClick="nextels();return false"></a></td></tr>
                                </table>
            </div>

在 Quirks 模式之后,甚至表格内的链接元素都无法与背景图像正确显示。我还附上了一些照片。Quirks 模式和 IE7 模式 在此处输入图像描述 在此处输入图像描述

任何帮助是极大的赞赏

4

1 回答 1

2

那是因为宽度和高度应该有测量单位,比如pxmm

width:190; height:78;=>width:190px; height:78px;应该可以解决您的问题。

此外,应用于inline元素的宽度不会做任何事情。考虑使用inlin-block你的 div 而不是inline.

并且,padding: 10 12 10 12=> padding: 10px 12px 10px 12px=>padding: 10px 12px

最后:width =20px=>width:20px

这是一个带有这些修复的JsFiddle

于 2013-09-25T14:38:46.547 回答