簡體   English   中英

CSS位置固定且絕對不能在chrome中工作

[英]CSS position fixed and absolute not working in chrome

你好這真的很奇怪,除非我錯過了什么。 在我的網站上,我有一個靜態標題欄,設置到固定的位置,除了在1頁上完全正常工作,我無法弄清楚原因。 這也只發生在chrome中。 類“頂欄定位:固定”的div

<header>
    <div class="top-bar">
        <div class="top-wrapper">
            <a href="/" style="display:block !important;"><div class="logo"></div></a>
            <a href="/add-event" style="display:block !important;"><div class="add-event button"></div></a>
            <a href="/events" style="display:block !important;"><div class="all-events button"></div></a>
            <div class="search-wrapper">
                <form class="searchform" action="" method="post" onsubmit="window.location.href = '/search/'+$('.searchfield').val()+'/1';return false;">
                    <input class="searchfield" type="text" name="search" placeholder="search...">
                    <input class="searchbutton" type="submit" name="search-submit" value="Go">
                </form>
            </div>
        </div>
    </div>
</header>

這是css:

-webkit-transform: translate(0) !important;
background: url(../gfx/field_bg.png) repeat-x left top;
height: 40px;
width: 100%;
position: absolute !important;
top: 0px;
left: 0px;
-moz-box-shadow: 0 0 20px #000;
-webkit-box-shadow: 0 0 20px black;
box-shadow: 0 0 20px black;
border-bottom: 1px solid lightgray;
z-index: 998;

在檢查器中,切換-webkit-transform: translate(0) !important <header>解決了我的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM