CSS菜单栏隐藏在IE11中的pdf下方

时间:2015-05-05 06:23:54

标签: html css html5 css3

我正在尝试获取标签对象上的pdf上方的水平菜单栏我尝试了多个选项(仅适用于IE),我在互联网上找到但没有人帮我。 下面是我尝试过的代码(也是从网站示例中复制的代码)。

<html xml:lang="en-us" xmlns="http://www.w3.org/1999/xhtml" lang="en-us"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>IE Dropdown Bug Fix | jonathanstegall.com</title>
<style type="text/css">
        body {
            text-align: center;
            font: normal 76% Verdana, Arial, Helvetica, sans-serif;
            padding: 1em;
            line-height: 1.8em;
        }

        #wrapper {
            width: 770px;
            margin: 0 auto;
            text-align: left;
            border: 1px solid #ddd;
            padding: 20px 10px;
        }

        #wrapper #header {
            position: relative;
            z-index: 2;
        }

        #wrapper #nav {
            clear: both;
            margin: 0 5px;
            padding: 0 5px;
            width: 750px;
            height: 30px;
            list-style: none;
            border-top: 1px solid #335a86;
            border-bottom: 1px solid #335a86;
            text-align: center;
            position: relative;
            z-index: 2;
        }

        #wrapper #nav li {
            float: left;
            margin: 0;
            padding: 0 0 5px 0;
            border: 0;
            position: relative;
        }

        #wrapper #nav li a {
            margin: 0;
            padding: 7px 15px;
            display: block;
            text-decoration: none;
            font-size: 1.2em;
        }

        #wrapper #nav a:link, #wrapper #nav a:visited {
            color: #888;
        }

        #wrapper #nav a:hover, #wrapper #nav a:focus {
            color: #335a86;
        }

        #wrapper #nav li ul {
            background-color: #ccc;
            border: 0;
            width: 150px;
            height: auto;
            list-style: none;
            margin: 0;
            padding: 5px 0 10px 0;
            border: 0;
            text-align: left;
            position: absolute;
          display: none;
        }

        #wrapper #nav li ul li {
            float: none;
            margin: 0;
            line-height: 30px;
            height: 30px;
        }

        #wrapper #nav li ul a {
            padding: 7px 10px;
            white-space: nowrap;
            display: block;
        }

        #wrapper #nav li:hover ul {
          display: block;
        }

        #wrapper #container {
            padding: 10px;
            position: relative;
        }

        #wrapper h1 {
            position: absolute;
            left: 10px;
            top: 10px;
            height: 60px;
            line-height: 60px;
            vertical-align: middle;
            font-size: 2em;
            background: #335a86;
            color: #fff;
        }

        #wrapper #container p.intro {
            margin-top: 60px;
        }

        #wrapper #container p {
            margin: 1em 0;
        }

        #wrapper #container form {
            padding: 1em 0;
        }

        #wrapper #container label, #wrapper #container select {
            float: left;
            display: block;
            margin: 0 1em 0 0;
        }
</style>
    </head>
    <body>
    <div id="wrapper">
    <div id="header">
    <ul id="nav">
    <li><a href="#">home</a></li>
    <li><a href="#">item one</a>
      <ul>
        <li><a href="#">sub item one</a></li>
        <li><a href="#">sub item two</a></li>
        <li><a href="#">sub item three</a></li>
        <li><a href="#">sub item four</a></li>
        <li><a href="#">sub item five</a></li>
        <li><a href="#">sub item six</a></li>
      </ul>
    </li>
    <li><a href="#">item two</a>
        <ul>
        <li><a href="#">sub item one</a></li>
        <li><a href="#">sub item two</a></li>
      </ul>
    </li>
    </ul>
    </div>
    <div id="container">

    <h1>Hi. This is a positioned H1</h1>
    <p class="intro">This page is just some friendly content to show you just how bad IE really is. You could replace the absolutely positioned H1 above with a <code>&lt;select&gt; &lt;/select&gt;</code> as I do below, a Flash movie, or whatever you like.</p>
    <form name="form" id="form">
      <label>To indicate this:</label>
      <select name="foo" id="foo">
        <option value="IE is mean">IE is mean</option>
        <option value="IE sucks">IE sucks</option>
        <option value="Maybe IE8 will be okay">Maybe IE8 will be okay</option>
      </select>
    </form>
    <object id="pdfshow"  style="background-color:#FFFFFF;" data="1.pdf??wmode=transparent" type="application/pdf" width="99.5%" height="550">
    </object>
    </div>
    </div>

</body>
</html>

请告诉我,我做错了,因为我也使用了position:relative , z-index:999。 这是小提琴链接。 http://jsfiddle.net/h2knhyb4/
在此先感谢。

2 个答案:

答案 0 :(得分:0)

这是一个黑客攻击,因为我在<ul>旁边使用额外的iframe,但它在我们所有浏览器中都需要它的工作方式(即FF,chrome,IE11)。 我在网上找到了这个答案,目前没有链接,所以更新了代码以供将来参考。

  <html xml:lang="en-us" xmlns="http://www.w3.org/1999/xhtml" lang="en-us"><head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>IE Dropdown Bug Fix | jonathanstegall.com</title>
  <style type="text/css">
    body {
        text-align: center;
        font: normal 76% Verdana, Arial, Helvetica, sans-serif;
        padding: 1em;
        line-height: 1.8em;
    }

    #wrapper {
        width: 770px;
        margin: 0 auto;
        text-align: left;
        border: 1px solid #ddd;
        padding: 20px 10px;
    }

    #wrapper #header {
        position: relative;
        z-index: 2;
    }

    #wrapper #nav {
        clear: both;
        margin: 0 5px;
        padding: 0 5px;
        width: 750px;
        height: 30px;
        list-style: none;
        border-top: 1px solid #335a86;
        border-bottom: 1px solid #335a86;
        text-align: center;
        position: relative;
        z-index: 2;
    }

    #wrapper #nav li {
        float: left;
        margin: 0;
        padding: 0 0 5px 0;
        border: 0;
        position: relative;
    }

    #wrapper #nav li a {
        margin: 0;
        padding: 7px 15px;
        display: block;
        text-decoration: none;
        font-size: 1.2em;
    }

    #wrapper #nav a:link, #wrapper #nav a:visited {
        color: #888;
    }

    #wrapper #nav a:hover, #wrapper #nav a:focus {
        color: #335a86;
    }

    #wrapper #nav li ul {
        background-color: #ccc;
        border: 0;
        width: 150px;
        height: auto;
        list-style: none;
        margin: 0;
        padding: 5px 0 10px 0;
        border: 0;
        text-align: left;
        position: absolute;
      display: none;
    }

    #wrapper #nav li ul li {
        float: none;
        margin: 0;
        line-height: 30px;
        height: 30px;
    }

    #wrapper #nav li ul a {
        padding: 7px 10px;
        white-space: nowrap;
        display: block;
    }

    #wrapper #nav li:hover ul {
      display: block;
    }

    #wrapper #container {
        padding: 10px;
        position: relative;
    }

    #wrapper h1 {
        position: absolute;
        left: 10px;
        top: 10px;
        height: 60px;
        line-height: 60px;
        vertical-align: middle;
        font-size: 2em;
        background: #335a86;
        color: #fff;
    }

    #wrapper #container p.intro {
        margin-top: 60px;
    }

    #wrapper #container p {
        margin: 1em 0;
    }

    #wrapper #container form {
        padding: 1em 0;
    }

    #wrapper #container label, #wrapper #container select {
        float: left;
        display: block;
        margin: 0 1em 0 0;
    }
   .cover 
   {
    position:absolute;
    z-index:-2;
   }
  </style>
  </head>
  <body>
  <div id="wrapper">
  <div id="header">
  <ul id="nav">
    <li><a href="#">home</a></li>
  <li><a href="#">item one</a>
   <ul>
     <iframe src="about:blank" class="cover" />
     <li><a href="#">sub item one</a></li>
    <li><a href="#">sub item two</a></li>
    <li><a href="#">sub item three</a></li>
    <li><a href="#">sub item four</a></li>
    <li><a href="#">sub item five</a></li>
    <li><a href="#">sub item six</a></li>
  </ul>
</li>
<li><a href="#">item two</a>
    <ul>
    <iframe src="about:blank" class="cover" />
    <li><a href="#">sub item one</a></li>
    <li><a href="#">sub item two</a></li>
  </ul>
</li>
</ul>
</div>
<div id="container">

  <h1>Hi. This is a positioned H1</h1>
   <p class="intro">This page is just some friendly content to show you just how bad IE really is. You could replace the absolutely positioned H1 above with a <code>&lt;select&gt; &lt;/select&gt;</code> as I do below, a Flash movie, or whatever you like.</p>
<form name="form" id="form">
  <label>To indicate this:</label>
  <select name="foo" id="foo">
    <option value="IE is mean">IE is mean</option>
    <option value="IE sucks">IE sucks</option>
    <option value="Maybe IE8 will be okay">Maybe IE8 will be okay</option>
  </select>
  </form>
  <object id="pdfshow"  style="background-color:#FFFFFF;" data="1.pdf" type="application/pdf" width="99.5%" height="550">
  </object>
  </div>
  </div>

 </body>
 </html>

答案 1 :(得分:-1)

上面的黑客似乎不起作用 - 将.cover部分添加到样式表中,将iframe行添加到JSFiddle中的html代码不能解决问题 - 下拉菜单显示为空白框,没有内容IE11?