2 fairytale zf fairytale_zf 于 2014.01.16 14:44 提问

css设置background-image不起作用,去掉<div id="menuBar">的id就行了,求具体原因
css
<html>
<head>
    <style type="text/css">
        #menuBar {
            /*display: none;*/
            background-color: #fffd7a;
            width: 100%;
        }

        #menuBar div.menuItemTr {
            /*// display: inline-block;*/
            float: left;
            overflow: auto;

            border: 0px solid #FFF;
            border-right-color: #CCC;
            border-bottom-color: #CCC;

            /*padding: 0.6px;*/
            display: block;
            background: #EEE;
            color: #666;
            font: block 12px/22px Verdana, Arial, Helvetica, sans-serif;
            text-decoration: none;
            height: auto !important;
            height: 1%; /*For IE*/
        }

        #menuBar div.menuItemTd div.menu {
            padding-left: 12px;
        }

        #menuBar div.menuItemTrImg {
            background-image: url("common/css/img/ui-icons_454545_256x240.png");
            background-position: -64px -16px;
            background-repeat: no-repeat;
            width: 16px;
            height: 16px;
        }

        #menuBar div.menuItemTdImg {
            background-image: url("common/css/img/ui-icons_222222_256x240.png");
            background-position: -32px -16px;
            background-repeat: no-repeat;
            width: 16px;
            height: 16px;
        }

        #menuBar div.subMenu {
            position: absolute;
            word-break: keep-all;
            white-space: nowrap;
            background-color: #d24e58;
            cursor: pointer;
            z-index: 999;
        }

        #menuBar div.subMenu div {

            border: 1px solid #FFF;
            border-right-color: #CCC;
            border-bottom-color: #CCC;

            /*padding: 0.6px;*/
            /*display: block;*/
            background: #EEE;
            color: #666;
            font: solid 10px/22px Verdana, Arial, Helvetica, sans-serif;
            height: auto !important;
            height: 1%; /*For IE*/
        }

        #menuBar div.subMenu div:hover {
            background: #000079;
            color: #FFF;
        }

        #menuBar div.menuItemTr:hover {
            border-left: 0px inset #FFF;
            border-right: 0px inset #FFF;
            border-top: 0px inset #FFF;
            border-bottom: 0px inset #FFF;
            background: #FFFFFF;
        }
    </style>
</head>
<body>
<hr/>
<div id="menuBar">
    <div class="menuItemTr">
        <div style="display:table-row;">
            <div class="menuItemTrImg"></div>
        </div>
        <div class="subMenu" style="display: block;">
            <div class="menuItemTd" style="display: table-row;">
                <div style="display:table-cell">
                    <div style="display:table-cell">
                        <div class="menuItemTdImg"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<hr/>
</body>
</html>
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!