简体   繁体   中英

css position:fixed not working in ie

I have a div which position is fixed, within that i have a div with position absolute....

There is absolute positioned div is working..... But position:fixed is not working in ie........

Hope you understand...

HTML

   <div class="container">
<div class="cont_left">
    <div style="position:relative">
    <div id="nav">
    <div style="display: block;" class="menu"> <a href="#">
            about
            </a>
        </div>
    <div style="display: block;" class="menu"> <a href="#">
            services
            </a>
        </div>

        ......

        </div>
    </div></div></div>

CSS

.container{
    width:100%;
    float:left;
}
.cont_left{
    width:164px;
    float:left;
    padding:0;
    position:fixed;
}

#nav{
    width:164px;
    float:left;
    padding:0;
    list-style:none;
    margin:58px 0 46px 0;
    position:absolute;
    top:0;
    left:0;
}

您可以尝试以下方法: http : //ryanfait.com/position-fixed-ie6/

只需在<!doctype html>顶部添加<!doctype html>

If you use XHTML instead of HTML then position:fixed is definitely work. On starting of your HTML page you have to add

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM