Reputation: 71
I'm working on a main menu, and I want to use jquery to be able to toggle whether or not the table shows. This is the 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>
And for the 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%
}
I created the nested table as the goal is to have it drop down once the user hovers over it, but it appears when i initially have it as display: hidden
, it doesnt even notice it. However it only doesn't notice that as a nested table. My question is, how can I target that nested table through CSS, to have it initially be hidden?
Upvotes: 1
Views: 1043
Reputation: 29501
Two quick lines of CSS, will give you what you need.
<table>
, initially<tr>
preceding the <tr>
containing the <td>
containing the nested <table>
.CSS:
table table {
display: none;
}
tr:hover + tr td table {
display: block;
}
Upvotes: 2