3

私のウェブサイト、特にCSSに問題があります。私はウェブデザインにかなり慣れていないので、これらのことが次々と出てきます。通常、自分でそれを理解するのは簡単ですが、これには本当に困惑しています。

基本的に何が起こっているかというと、順序付けられていないリストの最後の 2 つの要素が何らかの理由で下に移動します (下の画像)。まったく見当がつきません。私が見つけた唯一の解決策は、クラスを追加して自分で手動で移動することでした。

同様に、問題は IE 9.0 で発生しますが、javascript を有効にした場合のみです (サブメニュー項目に対してこれを行う必要があります)。

何が起こっているかについての洞察 (指を交差させれば簡単に修正できます) は驚くべきものです。

ここに画像の説明を入力

<div id="main_menu">
            <div id="main_menu_container">
                <ul>
                    <li><a href=# id="home_button">Home</a></li>
                    <li><a href=# id="products_button">Products</a></li>
                    <li class="baq"><a href=# id="baq_button">Book a Quote</a></li>
                    <li><a href=#>Gallery</a></li>
                    <li class="misplace"><a href=#>About Us</a></li>
                    <li class="misplace"><a href=#>Contact Us</a></li>
                </ul>
            </div>
        </div> <!--END OF MAIN MENU -->

そしてCSS...

div#main_menu{
    height:45px;
    position:relative;
    z-index:11;

    background: rgb(246,246,246);
    background: -moz-linear-gradient(top,  rgba(246,246,246,1) 0%, rgba(225,225,225,1) 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(246,246,246,1)), color-stop(100%,rgba(225,225,225,1)));
    background: -webkit-linear-gradient(top,  rgba(246,246,246,1) 0%,rgba(225,225,225,1) 100%);
    background: -o-linear-gradient(top,  rgba(246,246,246,1) 0%,rgba(225,225,225,1) 100%);
    background: -ms-linear-gradient(top,  rgba(246,246,246,1) 0%,rgba(225,225,225,1) 100%);
    background: linear-gradient(to bottom,  rgba(246,246,246,1) 0%,rgba(225,225,225,1) 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f6f6f6', endColorstr='#e1e1e1',GradientType=0 );

    -webkit-box-shadow: inset 0px -1px 0px 1px rgba(255, 255, 255, .2);
    box-shadow: inset 0px -1px 0px 1px rgba(255, 255, 255, .2);

}

div#shadow_1{
    position:relative;
    background:url('images/shadow_grad.png') repeat-x;
    height:6px;
    z-index:20;
}

div#main_menu div#main_menu_container{
    width:920px;
    height:45px;
    margin:0 auto;
}

#main_menu #main_menu_container ul li{
    position:relative;
    float:left;
    list-style:none;
    width:150px;
    height:45px;
    line-height:45px;
    text-align: center;
    margin:0px 0px;
    padding:0px 0px;
    z-index:21;

    font-family: 'Roboto Condensed', sans-serif;
    font-size:16px;
    font-weight: 700;
    color:#747474;
    text-transform: uppercase;
}

#main_menu #main_menu_container ul li a{
    display:block; 
    color:#747474;

    transition:all .05s linear;
    -o-transition:all .05s linear;
    -moz-transition:all .05s linear;
    -webkit-transition:all .05s linear;
}

#main_menu #main_menu_container ul li.baq a{background:#3d9dff; color:white;}

#main_menu #main_menu_container ul li a:hover{
    /*background:#ffab00;*/
    background:#ffab00; /*#3d9dff*/
    color:white;
}


li.misplace{position:relative; top:-18px;}

jQUERYコード(実際にはjqueryを知らないので、他の人にやってもらいました。つまり、アドバイスが頭に浮かぶかもしれません:/):

$(document).ready(function(){
    $("#products_button").mouseenter(function(){
        $(".products").addClass("active_products");
        $(".products_container").addClass("active_products_container");
    });
});

$(document).ready(function(){
    $(".products").mouseenter(function(){
        $(".products").addClass("active_products");
        $(".products_container").addClass("active_products_container");
    });
});

$(document).ready(function(){
    $(".products").mouseleave(function(){
        $(".products").removeClass("active_products");
        $(".products_container").removeClass("active_products_container");
    });
});

$(document).ready(function(){
    $("#home_button, #baq_button, #header").mouseenter(function(){
        $(".products").removeClass("active_products");
        $(".products_container").removeClass("active_products_container");
    });
});
4

3 に答える 3

0

@ user1090635クラスを削除してから、li.misplace{} 次のデモのように中央メニューのcssを変更します:http://jsfiddle.net/bsPrabu/EtmSW/6/embedded/result/

 div#main_menu div#main_menu_container {
    width:100%;
    text-align:center;
    height:45px;
    margin:0 auto;
}

#main_menu #main_menu_container ul
{
     display:inline-block;
    *display:inline;/* IE*/
    *zoom:1;/* IE*/
    overflow:hidden;
    text-align:left;
}
于 2013-02-23T10:47:07.953 に答える
0

ここでは正常に動作していますhttp://jsfiddle.net/KmrZ3/1/なし.misplace

したがって、ここに表示されていない他の場所の css (または javascript) である可能性があります

于 2013-02-23T10:40:50.443 に答える