gpt4 book ai didi

javascript - IE 10/11 中的 CSS MegaMenu 全宽

转载 作者:太空宇宙 更新时间:2023-11-04 11:51:26 26 4
gpt4 key购买 nike

我正在使用一些自定义样式制作 Superfish 菜单,以使菜单全宽且响应迅速。我的元素在 Google Chrome 和 Firefox 上运行良好,但在 IE 11 上运行不佳。

看看这个Sample

* { margin:0; padding:0; }
html { height: 100%; width: 100%; }
body { font-size:13px; color:#777; text-align:center; min-width:250px; position:relative; }
body > .wrapper { position:relative; }
.page { margin: 0 auto; padding: 0 0 0; text-align: left; width: 900px; }

.sf-menu, .sf-menu * { margin: 0; padding: 0; list-style: none; }
.sf-menu { position: relative; float: none; width: 100%; display: table; font-family: Tahoma, Helvetica, Arial, sans-serif; }
.sf-menu li { position: relative; -webkit-transition: background .2s; -moz-transition: background .2s; -o-transition: background .2s; transition: background .2s; }
.sf-menu ul { position: absolute; padding-top: 15px; padding-bottom: 15px; display: none; top: 100%; left: 0; z-index: 99; min-width: 12em; }
.sf-menu li.last > ul { left: inherit; right:0; }
.sf-menu > li { float: none; display: table-cell; }
.sf-menu li:hover > ul, .sf-menu li.sfHover > ul { display: block; }
.sf-menu a { display: block; position: relative; zoom: 1; }
.sf-menu ul ul { top: 0; left: 100%; }

/*** Default Skin ***/
#menu-icon, .sf-menu-phone, .sf-menu-block { display: none; }
.sf-menu { border:1px solid #ddd; border-bottom-color:#b0afaf; background:#e4e5e6; box-shadow:0 3px 6px rgba(0,0,0,0.08); }
.sf-menu > li { border-right: 1px solid #ddd; vertical-align: middle; }
.sf-menu > li:last-child { border-right: 0; }
.sf-menu > li:last-child > ul ul { left: auto; right: 100%; }
.sf-menu li a { color: #333; text-decoration: none; padding: 0; }
.sf-menu > li > a > span { display: block; font-size: 1.4em; line-height: 18px; cursor: pointer; padding: 18px 5px; text-align: center; }
.sf-menu li ul a span { white-space: normal; }
.sf-menu > li.parent > a span { margin-right: 0; }
.sf-menu > li.sfHover > a,
.sf-menu> li > a:hover,
.sf-menu > li.active > a { background: #fff; color: #000; }
.sf-menu ul { background-color: #FFF; border-top:5px solid #515151; box-shadow:0 4px 10px 0 rgba(150, 150, 150, 1); }
.sf-menu > li > a:before,
.sf-menu li li.parent > a:before { font-size: 14px; color:#ddd; float: right; }
.sf-menu > li > a:before { line-height: 54px; margin-right: 10px; }
.sf-menu li li a { display:block; background: none; font-size: 13px; line-height: 16px; color: #777; padding:4px 20px; }
.sf-menu li li > a:hover,
.sf-menu li li.sfHover > a,
.sf-menu li li.active > a,
.sf-menu li li > a:hover:before,
.sf-menu li li.sfHover > a:before,
.sf-menu li li.active > a:before { color: #333; }

.sf-arrows .sf-with-ul { padding-right: 0.5em; }
.sf-arrows .sf-with-ul:after { content: ''; position: absolute; top: 50%; right: 1em; margin-top: -3px; height: 0; width: 0; border: 5px solid transparent; border-top-color: #000; border-top-color: rgba(0,0,0,1); }
.sf-arrows > li > .sf-with-ul:focus:after,
.sf-arrows > li:hover > .sf-with-ul:after,
.sf-arrows > .sfHover > .sf-with-ul:after { border-top-color: #FFF; }
.sf-arrows ul .sf-with-ul:after { margin-top: -5px; margin-right: -3px; border-color: transparent; border-left-color: #000; border-left-color: rgba(0,0,0,1); }
.sf-arrows ul li > .sf-with-ul:focus:after,
.sf-arrows ul li:hover > .sf-with-ul:after,
.sf-arrows ul .sfHover > .sf-with-ul:after { border-left-color: #999; }

/* MegaMenu */
.mega-pos-01 { position: initial !important; }
.mega-pos-02 { position: relative !important; }
.megamenu { }
.megamenu > li.last-col > ul,
.megamenu > li.last-col > ul ul { left: auto; right: 100%; }
.megamenu li { float:left; padding: 0; text-align:left; margin-left:2%; }
.megamenu li ul li { float:none; width: auto; margin-left:0; }
.megamenu li ul a span { white-space: nowrap; }
.mega-wFull { width: 100% !important; }
.mega-w200 { width: 200px; }
.mega-w250 { width: 250px; }
.mega-w300 { width: 300px; }
.mega-w350 { width: 350px; }
.mega-w400 { width: 400px; }
.mega-w450 { width: 450px; }
.mega-w500 { width: 500px; }
.mega-w550 { width: 550px; }
.mega-w600 { width: 600px; }
.mega-w650 { width: 650px; }
.mega-w700 { width: 700px; }
.mega-col2 li { width: 48%; }
.mega-col3 li { width: 31.3333%; }
.mega-col4 li { width: 23%; }
.mega-col5 li { width: 18%; }
.mega-col6 li { width: 14.6666%; }
.mega-col7 li { width: 12.2857%; }
.mega-col8 li { width: 10.5%; }
<body>
<div class="wrapper">
<div class="page">
<ul id="nav" class="sf-menu">
<li class="level0 level-top parent first"><a href="#" target="_self" class=" level-top "><span>Category 01</span></a>
<ul class="level0 ">
<li class="level1 first "><a href="#" target="_self" class=""><span>cabelos</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>olhos</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>lábios</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>corpo</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>pescoço</span></a></li>
<li class="level1 first last last-col"><a href="#" target="_self" class=""><span>unhas</span></a></li>
</ul>
</li>
<li class="level0 level-top parent mega-pos-01"><a href="#" target="_self" class=" level-top "><span>Category 02</span></a>
<ul class="level0 megamenu mega-wFull mega-col6">
<li class="level1 parent first "><a href="#" target="_self" class=" "><span>subcategoria 01</span></a>
<ul class="level1 ">
<li class="level2 first last "><a href="#" target="_self" class=""><span>face</span></a></li>
</ul>

</li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 41</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 02</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 03</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 04</span></a></li>
<li class="level1 parent last-col"><a href="#" target="_self" class=" "><span>subcategoria 05</span></a>
<ul class="level1 ">
<li class="level2 parent first "><a href="#" target="_self" class=" "><span>subcategoria 37</span></a>
<ul class="level2 ">
<li class="level3 first "><a href="#" target="_self" class=""><span>subcategoria 34</span></a></li>
<li class="level3 first last "><a href="#" target="_self" class=""><span>subcategoria 33</span></a></li>
</ul>

</li>
<li class="level2 parent first last "><a href="#" target="_self" class=" "><span>subcategoria 38</span></a>
<ul class="level2 ">
<li class="level3 first "><a href="#" target="_self" class=""><span>subcategoria 36</span></a></li>
<li class="level3 first last "><a href="#" target="_self" class=""><span>subcategoria 35</span></a></li>
</ul>

</li>
</ul>
</li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 06</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 07</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 08</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 09</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 10</span></a></li>
<li class="level1 last-col"><a href="#" target="_self" class=""><span>subcategoria 11</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 12</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 13</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 14</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 15</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 16</span></a></li>
<li class="level1 last-col"><a href="#" target="_self" class=""><span>subcategoria 17</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 18</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 19</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 20</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 21</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 22</span></a></li>
<li class="level1 last-col"><a href="#" target="_self" class=""><span>subcategoria 23</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 24</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 25</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 26</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 27</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 28</span></a></li>
<li class="level1 last-col"><a href="#" target="_self" class=""><span>subcategoria 29</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 30</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 31</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>subcategoria 32</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>feminino</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>masculino</span></a></li>
<li class="level1 first last last-col"><a href="#" target="_self" class=""><span>desodorante</span></a></li>
</ul>
</li>
<li class="level0 level-top "><a href="#" target="_top" class=" level-top"><span>Category 03</span></a></li>
<li class="level0 level-top "><a href="#" target="_top" class=" level-top"><span>Category 04</span></a></li>
<li class="level0 level-top parent last "><a href="#" target="_self" class=" level-top "><span>Category 05</span></a>
<ul class="level0 ">
<li class="level1 first "><a href="#" target="_self" class=""><span>outros</span></a></li>
<li class="level1 "><a href="#" target="_self" class=""><span>gel de banho</span></a></li>
<li class="level1 parent first last "><a href="#" target="_self" class=" "><span>loção corporal</span></a>
<ul class="level1 ">
<li class="level2 first "><a href="#" target="_self" class=""><span>subcategoria 40</span></a></li>
<li class="level2 first last "><a href="#" target="_self" class=""><span>subcategoria 39</span></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
</body>

要进行测试,请将鼠标悬停在菜单项“Category 02”上,看看它在 Chrome 和 FF 上运行良好但在 IE 上运行不佳。

我将不胜感激!

非常感谢!

最佳答案

将 mega-pos-01 类元素的位置 CSS 属性从初始更改为静态似乎对我有用。遗憾的是,我希望能进行一些 jQuery 操作。

.mega-pos-01 { position: static !important; }

http://jsfiddle.net/cg0bnpjo/

关于javascript - IE 10/11 中的 CSS MegaMenu 全宽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30606879/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com