I'm trying to create a menu that has a mouse over drop down to select a sub-menu item. I currently have the common menu working, but I can't figure out the best way to go about having the sub menus display beneath their appropriate categories.
The menus currently stretch the table to distorted proportions. I want the current table to keep its size and just drop below the category title, without affecting the category's title table. Should I create another table to display to that or what? I'm not familiar with web programming.
My second problem is probably a very easy one. I'm just not sure what the answer is. I've tried my luck with Google to no avail. What should I set "onMouseOut" display equal to in order to keep the menus populated. The submenu currently disappear when I try to click one of the sub-links.
<td>
<STYLE TYPE="text/css">
#menu1 { display : none }
#menu2 { display : none }
#menu3 { display : none }
A:link {color:blue; text-decoration:none}
A:hover {color:blue; text-decoration:underline}
</STYLE>
<div id="menu">
<table border="0" cellspacing="0" cellpadding="2" align="center">
<tbody>
<tr>
<td style="cursor: pointer; background-color: rgb(204, 238, 255); " onmouseover="this.style.backgroundColor='#E5F6FF';" onmouseout="this.style.backgroundColor='#CCEEFF'" valign="top" align="top-center" onclick="window.location.href='index2.php?page=files'"> Files</td>
<td style="cursor: pointer; background-color: rgb(204, 238, 255); " onmouseover="this.style.backgroundColor='#E5F6FF';" onmouseout="this.style.backgroundColor='#CCEEFF'" valign="top" align="center">
<SPAN onMouseOver="document.all.menu2.style.display = 'block'"onMouseOut="document.all.menu2.style.display = 'none'">
Configuration<BR>
</SPAN>
<SPAN ID="menu2" onClick="document.all.menu1.style.display = 'none'">
System Configuration<BR>
File Configuration<BR>
Network Configuration<BR>
</SPAN>
<td style="cursor: pointer; background-color: rgb(204, 238, 255); " onmouseover="this.style.backgroundColor='#E5F6FF';" onmouseout="this.style.backgroundColor='#CCEEFF'" valign="top" align="center" onclick="window.location.href='index2.php?page=Maintenance'"> Maintenance Mode</td>
<td style="cursor: pointer; background-color: rgb(204, 238, 255); " onmouseover="this.style.backgroundColor='#E5F6FF';" onmouseout="this.style.backgroundColor='#CCEEFF'" valign="top" align="center" onclick="window.location.href='index2.php?page=IETM'"> IETM</td>
<td style="cursor: pointer; background-color: rgb(204, 238, 255); " onmouseover="this.style.backgroundColor='#E5F6FF';"onmouseout="this.style.backgroundColor='#CCEEFF'" valign="top" align="center">
<SPAN onMouseOver="document.all.menu3.style.display = 'block'"onMouseOut="document.all.menu3.style.display = 'none'">
Power Options<BR>
</SPAN>
<SPAN ID="menu3" onClick="document.all.menu1.style.display = 'none'">
Shutdown<BR>
Reboot<BR>
</SPAN>
</td>
</td>
</tr>
</tbody>
</table>
</div>
</TABLE>
first of all do not use tables, they are liming your options in many ways. You can use divs instead or in your particular example(for menu) you could use html lists.
another thing about your concerte problem is if you can use javaScript (to simplify things a bit) and then you could say:
<ul id="menu">
<li id="link1">Link 1
<ul class="dropdown">
<li id="sl1">Sublink 1</li>
<li id="sl2">Sublink 2</li>
<li id="sl3">Sublink 3</li>
</ul>
</li>
<li id="link2">Link 2</li>
...
<li id="link3">Link 3</li>
...
</ul>
with appropriate css ofcourse, and on this use javaScript to ad show/hide functionality:
$(document).ready(function() {
$("#menu li").mouseenter(function(){
$(this).find(".dropdown").show();
});
$("#menu li").mouseleave(function(){
$(this).find(".dropdown").hide();
});
});
Related
I am building a website and I use a table as a header. The table has 7 columns. I use some code to automatically resize my website, the resize script works perfect. Everything resizes except the table when it is at a certain size. I think it's because of the cellpadding which is 15 but I want to keep it at 15. This is the table script:
<div id="header">
<table width="100%" align="center" cellpadding="0" cellspacing="20" style="font- family:Tahoma, Geneva, sans-serif; color:#FFFFFF; background:#FF0101">
<tr>
<td width="100%" height="70%" align="center" valign="top"><table align="left" cellpadding="15" cellspacing="0" class="menu">
<tbody><tr><td class="menu" bgcolor="#5B8CFF" onmouseover"style.backgroundColor='#B30000';" onmouseout="style.backgroundColor=''">Home</td>
<td class="menu" onmouseover="style.backgroundColor='#B30000';" onmouseout="style.backgroundColor=''">Transport</td>
<td class="menu" onmouseover="style.backgroundColor='#B30000';" onmouseout="style.backgroundColor=''">Distributie</td>
<td class="menu" onmouseover="style.backgroundColor='#B30000';" onmouseout="style.backgroundColor=''"> Historie</td>
<td class="menu" onmouseover="style.backgroundColor='#B30000';" onmouseout="style.backgroundColor=''">Vacatures</td>
<td class="menu" onmouseover="style.backgroundColor='#B30000';" onmouseout="style.backgroundColor=''">Route</td>
<td class="menu" onmouseover="style.backgroundColor='#B30000';" onmouseout="style.backgroundColor=''">Contact</td> </tr>
</tbody></table></td>
</tr>
</table></div>
I hope somebody could help me to let the table automatic resize with the website width and not stuck at a certain width. Thanks a lot. ( I changed the href to website because I want to keep the website I'm making this for private.)
I suggest you to change your structure to something more flexible, also remember use inline styles are not aceptable (if you only use them due to your example I think it is ok, but always use css, even for examples because it is easy to help you):
Example:http://jsfiddle.net/GBTg4/
HTML
<div id="nav">
<ul>
<li>Home</li>
<li>Transport</li>
<li>Distributie</li>
<li>Historie</li>
<li>Vacatures</li>
<li>Route</li>
<li>Contact</li>
</ul>
</div>
CSS
#nav ul
{
width:100%;
list-style-type: none;
margin:0;
padding:0;
}
#nav li
{
display:inline;
float:left;
width:14.28571428571429%;
background-color: blue;
text-align:center;
}
#nav a
{
color:#FFF;
line-height:35px;
display:inline-block;
width:100%;
}
#nav a:hover
{
background-color:#B30000;
}
Code is seemingly alright when viewing it with the source html/css files, but when is sent through "Webtools Toolbox", (a portal that manages Email+ and Skin Designs that utilizes HTML/CSS), the UL Menu breaks in the email. Is there a way to make the UL width scale to whatever parameter of the email content? You can view the source here: https://illinois.edu/skinDesigner/preview/10087
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="#">
<tr>
<td style="border: medium none;
font-size: 12px;
padding-bottom: 15px;
border-bottom: 1px solid #ddd;">
<ul style="list-style:none">
<li class="listle" ><a class="arttle"
href="http://promisemagazine.org/category/longform/">LONGFORM</a> |</li>
<li class="listle" ><a class="arttle"
href="http://promisemagazine.org/category/alumni/">ALUMNI</a> |</li>
<li class="listle" ><a class="arttle"
href="http://promisemagazine.org/category/community/">COMMUNITY</a> |</li>
<li class="listle" ><a class="arttle"
href="http://promisemagazine.org/category/giving/">GIVING</a> |</li>
<li class="listle" ><a class="arttle"
href="http://promisemagazine.org/category/opinion/">OPINION</a> |</li>
<li class="listle" ><a class="arttle"
href="http://promisemagazine.org/category/research/">RESEARCH</a>|</li>
<li class="listle" ><a class="arttle"
href="http://promisemagazine.org/category/schools/">SCHOOLS</a></li>
</ul>
</td>
</tr>
</table>
/td>
</tr>
You set class names on your elements, but there is no CSS. Email providers strip <head> and <body> tags from your document, so whatever you specified in there is lost.
Try to use <span> instead of li for you menu, or use a table for the menu. Table will take 100% of available width.
EDIT:
Another option is to simply show links:
<td style="border: medium none;
font-size: 12px;
padding-bottom: 15px;
border-bottom: 1px solid #ddd;">
LONGFORM |
ALUMNI |
COMMUNITY |
GIVING |
OPINION |
RESEARCH|
SCHOOLS
</td>
Not completely sure I understand the problem (are you worried about people changing the size of their email window, or if the content does not fit the table?)
Assuming you are trying to keep content within square window, try putting it in a div, and then adjusting the width of the div to fit your table, and displaying inline block. I added margin: 0 auto to center content like your format above.
Code example:
<div style="width: x; height: y; display: inline-block; margin: 0 auto">
<ul style="list-style:none">
<li>
<li>
<li>
<li>
</ul>
</div>
I would stick with only tables for HTML email. The source code looks horrible but that's your only option.
just got stuck when creating multiple columns with .tried several ways but could not make it appropriate.
<h3>Staff / Administration</h3>
<div align="center" class="center-content"><ul style="border-bottom: 1px solid #CFCFCF;"><strong>Administration</strong><br /></div>
<div class="page-style"><ul style="border-bottom: 1px solid #CFCFCF;">
<li style="width: 15%; text-align: left;"><b>NICK</b></li>
<li style="width:12%; text-align: left;"><em>Chief Executive Officer</em></li>
<li style='width:12%; text-align: center'><em>Demos</em></li>
<li style='width:12%; text-align: center'>Maps</li>
<li style='width:12%; text-align: center'>Movies</li>
<li style='width:12%; text-align: center'>Server</li>
<li style='width:12%; text-align: center'>Website</li>
</ul></div>
desired output is
Staff / Administration
administration
-------------------------------------------------------------------------------------
NICK Chief Executive Officer Demos Maps Movies server Website
As Mr. Alien suggests, it might be more appropriate to use a table for this sort of information.
However, if you're sure you want to use a list, you can style the individual list items to either float, or flow as inline blocks. My personally preferred method is inline-block. The example below is slightly reformatted from yours, and I've pulled the inline-block styling out into an inline CSS block.
<style type="text/css">
ul.adminTable > li {
display: inline-block;
}
</style>
<h3>Staff / Administration</h3>
<div align="center" class="center-content"><ul style="border-bottom: 1px solid #CFCFCF;"><strong>Administration</strong><br /></div>
<div class="page-style">
<ul style="border-bottom: 1px solid #CFCFCF;" class="adminTable">
<li style="width: 15%; text-align: left;"><b>NICK</b></li>
<li style="width:12%; text-align: left;"><em>Chief Executive Officer</em></li>
<li style='width:12%; text-align: center'><em>Demos</em></li>
<li style='width:12%; text-align: center'>Maps</li>
<li style='width:12%; text-align: center'>Movies</li>
<li style='width:12%; text-align: center'>Server</li>
<li style='width:12%; text-align: center'>Website</li>
</ul>
</div>
As Mr. Alien suggested, just use the <table> element for this:
<h3>Staff / Administration</h3>
<table border="0">
<tr>
<th colspan="7">
Administration
</th>
</tr>
<tr>
<th>
Nick
</th>
<td>
<em>Chief Executive Officer</em>
</td>
<td>
<em>Demos</em>
</td>
<td>
Maps
</td>
<td>
Movies
</td>
<td>
Server
</td>
<td>
Website
</td>
</tr>
</table>
You use tabular-data after all, so definally the way to go.
jsFiddle
I cleared up some of your invalid html code and added following css:
.page-style{
vertical-align: top;
}
ul {
display: inline;
vertical-align: top;
}
ul li {
display: inline-block;
width: 100px;
vertical-align: top;
}
.administration-title {
width: 100%;
border-bottom: 1px solid gray;
}
See demo here:
http://jsfiddle.net/T5t7q/
I am working on my website, http://www.isaveplus.com and I am having an issue of the table adding some space between each col (td) in it. My goal is to have the columns touching because I want the background color to blend in with each other. The picture below will show you what I meant by the space between them.
Thanks in advance!
<table style="width:inherit; margin-left:-5px; margin-top:-5px; " cellspacing="0">
<tr>
<td class="searchBar" align="left" >
<div id="ddtopmenubar" class="mattblackmenu" >
<ul>
<li><a style="vertical-align:bottom;">Best of Coupons</a></li>
<li>
<a style="vertical-align:bottom;"> Best of Travel</a>
<a style="vertical-align:bottom;">Grocery stores</a>
</li>
<li><a style="vertical-align:bottom;">Office Supplies</a></li>
<li><a style="vertical-align:bottom;"> Department <br /> stores </a></li>
<li><a style="vertical-align:bottom;">Drug <br /> stores</a></li>
</ul>
</div>
</td>
<td class="searchBar" align="left">
<asp:Button ID="whatIsIsavePlusButton" runat="server" onclick="whatIsIsavePlusButton_Click" style="color: #800000; font-weight: 700" Text="?" Visible="False" />
</td>
<td class="searchBar" align="left">social media right here!</td>
</tr>
</table>
And the css for searchbar is:
.searchBar
{
background-color: #414141;
color:White;
width:auto;
margin:-5px;
padding:0px;
}
Your links
<a style="vertical-align:bottom;">Best of Travel<a style="vertical-align:bottom;">Grocery stores</a>
have a
border-right: 1px solid white
defined in
.mattblackmenu li a
there you can set the width of these white spaces
Your code isn't displaying the same in my browser as in the picture you give. But essentially I think you either want to put a negative margin-right on the div ddtopmenubar or a border-left:1px solid white on the following td. There might be another way to do it but I think that'd work.
Have you tried the border-collapse property? http://www.w3schools.com/cssref/playit.asp?filename=playcss_border-collapse
border-collapse: collapse;
I've got a table where I've given each of the <td>s some styling to have a background color, etc. They also have different amounts of data in them. Specifically, I have two <td>s next to each other, and one has content in it that makes it taller than the other. In Chrome, the shorter <td> is the same height as the taller <td>, with styling and everything. In Firefox/IE, the shorter <td> just takes up as much room as needed. I've tried giving the <td> height: 100%, but that didn't really do anything. I also tried having a div inside the td with height: 100%, but that didn't do anything, either.
How can I get it to behave the same across all three browsers? I don't necessarily need it to be either way, although it would be nice to actually be able to control it. I mostly just need it to behave the same.
Here's the final html. It might be kind of hard to understand because there's a lot of knockout stuff in there.
<div class="container">
<div class="inner-container">
<table>
<tbody><tr><td style="text-align: right"><input type="button" id="manageSaveButtonTop" class="journal-button manage-save-button manage-save-button-top" value="Save"></td></tr>
<tr>
<td id="template" class="outer-div">
<h6>Templates</h6>
<ol class="journalTree sortable template manageJournal ui-sortable" >
<li class="group mine template">
<div>
<span class="itemText" data-bind="textToTextbox: Description">New Group</span>
</li>
<li class="no-nest mine template">
<div>
<span class="itemText" data-bind="textToTextbox: Description">New Objective</span>
</li>
</ol>
<!--</div>-->
</td>
<td id="myJournal" class="outer-div droppable ui-droppable">
<!--<div id="myJournal" class="outer-div droppable ui-droppable">-->
<h6>My Journal</h6>
<ol class="journalTree sortable myJournal manageJournal ui-sortable">
<li class="group mine ">
<div>
<span class="itemText" data-bind="textToTextbox: Description">New Group</span>
</li>
<li class="no-nest deleted ">
<div>
<span class="itemText" data-bind="textToTextbox: Description">Blank Objective</span>
</li>
<li class="group deleted ">
<div>
<span class="itemText" data-bind="textToTextbox: Description">Deleting Group</span>
<input type="text" style="display:none" class="itemTextBox"></div>
<ol >
<li class="no-nest deleted ">
<div>
<span class="itemText" data-bind="textToTextbox: Description">Test Deleting</span>
</li>
</ol>
</li>
<li class="group deleted ">
<div>
<span class="itemText" data-bind="textToTextbox: Description">New Group</span>
<input type="text" style="display:none" class="itemTextBox"></div>
<ol>
<li class="no-nest deleted ">
<div>
<span class="itemText" data-bind="textToTextbox: Description">New Objective</span>
</li>
</ol>
</li>
</ol>
<!--</div>-->
</td>
</tr>
<tr><td style="text-align: right"><input type="button" id="manageSaveButtonBottom" class="journal-button manage-save-button bottom" value="Save"></td></tr>
</tbody></table></div></div>
I can't set the height to a specific height, because the height of the right table changes dynamically (by adding more things to it). Here's the relevant CSS:
#myJournal
{
border: 1px solid black;
display: inline-block;
vertical-align: top;
background-color: #dde5e4;
width: 650px;
height: 100%;
border-radius: 25px;
-moz-border-radius: 25px;
}
#template
{
border: 1px solid black;
display: inline-block;
vertical-align: top;
background-color: #dde5e4;
width: 500px;
height: 100%;
margin-right: 100px;
border-radius: 25px;
-moz-border-radius: 25px;
}
Avoid setting any inline attributes and use CSS to style your tables instead. Try setting the cell width using CSS. You could do something like this (ideally you want your CSS in a separate file, but just to illustrate):
<style type="text/css">
table#myTable td {
height: 200px;
width: 200px;
}
</style>
<table id="myTable">
<tbody>
<tr>
<td>My data</td>
</tr>
</tbody>
</table>
If you want different sizes, create separate classes and apply them to your cells:
<style type="text/css">
td.small-cell {
width: 100px;
}
</style>
<table id="myTable">
<tbody>
<tr>
<td class="small-cell">My data</td>
</tr>
</tbody>
</table>
Finally, if you are starting a project, you might want to save yourself some time and use a CSS framework, like Twitter Bootstrap, that will sort out browser inconsistencies for you.