如何隐藏嵌套表?

时间:2015-12-10 20:19:53

标签: html css

我正在使用主菜单,我想使用jquery来切换表格是否显示。 这是HTML:

    <!DOCTYPE html>

<html>

<head>
    <title>Main Menu</title>
    <link rel="stylesheet" type="text/css" href="StyleSheet.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    <script src="jQuery.js" type="text/javascript"></script>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<div id="IndexBackgroundImage"></div>

<body id="Index">
    <div id="IndexLogoDiv">
        <img src="images/logo.gif" alt="HAS Logo" />
    </div>

    <center>

        <div id="IndexContent">

            <h1>Intranet</h1>

            <table>
                <tbody>
                    <tr>
                        <td>
                            <a href="BidList/BidListMainMenu.html"><img alt="Bid List" src="images/IndexBidList.png" /></a>
                        </td>
                    </tr>
                        <div id="BidListMainMenu">
                            <td><table>
                                <tbody>
                                    <tr>
                                        <td colspan="1">
                                            <a href="BidList/CurrentBid.php"> <img alt="Bid List alteration" src="images/BidList.png" /></a>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="1">
                                            <a href="Bidlist/NewProject.php"> <img alt="Add New Project" src="images/AddNewProject.png" /></a>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="1">
                                            <a href="BidList/EditProject.php"> <img alt="Edit Project" src="images/EditProject.png" /> </a>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="1">
                                            <a href="BidList/Priorities.php"> <img alt="Priorities" src="images/SetPriorities.png" /></td>
                                    </tr>
                                    <tr>
                                        <td colspan="1">
                                            <a href="BidList/Maintenence.php"> <img alt="Edit Project" src="images/Maintenence.png" /> </a>
                                        </td>
                                    </tr>
                                </tbody>
                            </table></td>
                        </div>
                    <tr>
                        <td><img alt="Bid List alteration" src="images/IndexMaintenence.png" /></td>
                    </tr>
                    <tr>
                        <td>
                            <a href="http://172.16.3.219/wordpress/"><img alt="Wordpress Page" src="images/IndexWordpress.png" /></td>
                    </tr>
                </tbody>
                </table>
        </div>
        <div id="IndexFooterDiv">
            <img src="images/address.gif" alt="Address" />
        </div>
    </center>
</body>

</html>

对于CSS:

html {
    background: url("images/MainBackground.jpg") no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

body {
    min-height: 100%;
}

#IndexLogoDiv {
    background: rgba(255, 255, 255, .75);
    border-radius: 3px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
    width: 100%;
}

#IndexContent {
    background: rgba(255, 255, 255, .25);
    width: 40%;
    border-radius: 3px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
    color: white;
    align-content: center;
    align-items: center;
    align-self: center;
    position: relative;
    margin-left: auto;
    padding: 10px;
    margin-right: auto;
    border: thin;
    z-index: 3;
}

#BidListMainMenu {
    display: none;
    background: rgba(255, 255, 255, .5);
    width: 70%;
    height: 85vh;
}

#IndexFooterDiv {
    background: rgba(255, 255, 255, .85);
    border-radius: 3px;
    align-content: center;
    align-items: center;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
    width: 99%;
    bottom: 0;
    padding-bottom: 10px;
    position: absolute;
    z-index: 5;
}

h1 {
    font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif
}

h2 {
    font-family: verdana;
    color: Navy;
    font-size: 200%;
}

h3 {
    font-family: verdana;
    color: Navy;
    font-size: 100%;
}

div1 {
    text-align: center;
    text-decoration: underline;
    font-family: verdana;
    color: Navy;
    font-size: 100%;
}

table {
    border: 0;
    width: 600;
    cellspacing: 10;
    cellpadding: 10;
    text-align: center;
}

td {
    text-align: Left;
    font-size: 150%
}

我创建了嵌套表,因为目标是在用户将鼠标悬停在其上时将其下拉,但是当我最初将其作为display: hidden时出现时,它甚至没有注意到它。但是它只是没有注意到它是一个嵌套表。我的问题是,如何通过CSS定位嵌套表,最初是否隐藏它?

1 个答案:

答案 0 :(得分:2)

两个快速的CSS系列将为您提供所需的产品。

  1. 第一行隐藏了嵌套的<table>,最初是
  2. 当光标悬停在包含嵌套<tr>的{​​{1}}的{​​{1}}之前的<tr>时,第二行会将嵌套表格显示为下拉列表。
  3. <强> CSS:

    <td>
相关问题