IE导航栏位于导航栏下方(可在Chrome和FF中使用)

时间:2018-07-12 16:53:38

标签: html css

我很抱歉,多年来我没碰过这些东西,所以我很生锈。

我的导航栏位于屏幕的左侧。表格位于页面中心,在Chrome和Firefox中也可以正常使用。但是,在IE中,该表被强制置于导航栏底部下方。任何帮助将不胜感激。谢谢!

以下是描述正在发生的事情的几张图片:

应如何显示: Using Chrome and Firefox

在IE中:Using IE

这是我的CSS表:

/* The sidebar menu */
        .sidenav {
        height: 100%; /* Full-height: remove this if you want "auto" height */
        width: 200px; /* Set the width of the sidebar */
        position: fixed; /* Fixed Sidebar (stay in place on scroll) */
        z-index: 1; /* Stay on top */
        top: 0; /* Stay at the top */
        left: 0;
        background-color: #dddddd;
        /* overflow-x: hidden; /* Disable horizontal scroll */
        padding-top: 1px;
        }

        /* The navigation menu links */
        .sidenav a {
            padding: 0px 8px 6px 8px;
            text-decoration: none;
            font-family: arial, sans-serif;
            font-size: 17px;
            color: #111;
            display: block;
        }

        /* When you mouse over the navigation links, change their color */
        .sidenav a:hover {
            color: #2F7BDC;
        }

        /* Style page content */
        .main {
            margin-left: 200px; /* Same as the width of the sidebar */
            padding: 0px 10px;
            font-family: arial, sans-serif;
            font-size: 17px;
            color: #111;
            display: block;
        }

        /* Table Style */
        .error {color: #FF0000;}
        table {
            font-family: arial, sans-serif;
            font-size: 13px;
            border-collapse: collapse;
            width: 50%;
            vertical-align: top;
        }

        td, th {
            border: 1px solid #dddddd;
            text-align: left;
            padding: 8px;
            font-size: 13px;
        }
        .tdright{
            text-align: right;
        }
         tr:nth-child(odd) {
            background-color: #dddddd;
        }

这是HTML:

<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="css/mystyle.css">
    <script src="//code.jquery.com/jquery.min.js"></script>
</head>

<body>
    <!-- Side navigation -->
    <div id="nav-placeholder">

    </div>
    <script>
        $.get("navbar.html", function(data){
        $("#nav-placeholder").replaceWith(data);
        });
    </script>

    <!-- Page content -->

    <div class="main">
        <form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
            <center>
        <table>
            <tr>
                <td colspan="2"><h2><center>Submit Info</h2></center></td>
            </tr>

            <tr>
                <td class="tdright">Comments:</td>
                <td><textarea name="comments" rows="3" cols="30"></textarea></td>
            </tr>
            <tr>
                <td class="tdright">Name:</td>
                <td><input type="text" name="name"></td>
            </tr>
            <tr>
                <td colspan='2'><input type="submit" name="submit" value="Submit">
                </td>

            </tr>
        </table>
            </center>

        </form>
    </div>

</body>

这是我正在调用的navbar.html:

<div class="sidenav">
<table> 
    <tr>
        <td><img src="images/image.jpg" width="180px"></td>
    </tr>
    <tr>
        <td><center><h2>Links</h2></center></td>
    </tr>
</table>
<a href="comments.php">Submit Comments</a>
<a href="reports.php">Reports</a>
<a href="#">Placeholder 1</a>
<a href="#">Placeholder 2</a>

0 个答案:

没有答案