内联样式不在IE7,8,9中呈现

时间:2013-09-25 14:01:59

标签: html css internet-explorer background inline-styles

我知道有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模式之后,甚至表格中的链接元素也无法正确显示背景图像。我还附上了一些照片。 怪癖模式和IE7模式 enter image description here enter image description here

非常感谢任何帮助

1 个答案:

答案 0 :(得分:2)

那是因为宽度和宽度高度应具有度量单位,例如pxmm

width:190; height:78; =&gt; width:190px; height:78px;应该解决您的问题。

同样,应用于inline元素的宽度也不起作用。 考虑将inlin-block用于您的div而不是inline

和,padding: 10 12 10 12 =&gt; padding: 10px 12px 10px 12px =&gt; padding: 10px 12px

最后:width =20px =&gt; width:20px

这里有JsFiddle这些修正