Thanks to Jennifer for this post: http://webdesign.about.com/od/csstutorials/f/set-css-height-100-percent.htm
The thing I has missed until I read this was the setting of the height for the html- and the body-element.
The HTML:
The CSS:
<body class="page" onload="menu.init(document.getElementById('menuContainer'));">
<div id="menuContainer"></div>
var menu = (function() {
return {
init: function(element) {
var menuHTML = "<ul class='menu'>";
menuHTML += " <li class='menuItem1'><a href='/index.html'>Nils Lande</a></li>";
menuHTML += " <li class='menuItem'><a href='/html/HelloWorld.html'>Hello World!</a></li>";
menuHTML += " <li class='menuItem'><a href='/html/WhereAreYou.html'>Where are you?</a></li>";
menuHTML += " <li class='menuItem'><a href='/html/About.html'>About</a></li>";
menuHTML += "</ul>";
element.insertAdjacentHTML("BeforeEnd", menuHTML);
return;
}
};
}) ();
.menuItem, .menuItem1 {
margin: 0px;
padding: 0px;
width: 200px;
height: 40px;
line-height: 40px;
float: left;
font-family: verdana;
vertical-align: bottom;
}
.menuItem1 {
font-size: 20px;
}
.menu {
list-style-type: none;
margin: 0px;
padding: 0px;
overflow: hidden;
background-color: lightgrey;
vertical-align: bottom;
}
.menuItem a, .menuItem1 a {
/*display: block;*/
width: 60px;
color: black;
}
.menuItem a:link, .menuItem1 a:link {
text-decoration: none;
}
(If you click the button above Chrome will log this error message: Refused to execute script from 'https://code.google.com/p/nilslande-blogger-code/source/browse/blog-posts/Post_10/js/HelloGoogleCode.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. ).
Putting my JavaScripts on Google Code seemed like a good idea after reading this:
http://www.problogtricks.com/2014/02/host-css-javascript-files-on-google-code.html
but not if you read this:
or this:
My previous post had a static class. Lets see if we can use that class in this post.
The button below has 2 different behaviours:
The code:>
Another post for experimenting with JavaScript. This really started when I made my second Google Earth post and relized that my Google Earth object (named 'ge') was global. This caused a lot of strange behaviour when more than one blog-post was shown at the same time.
This post contains my soultion to this problem; I will put my variable and functions into an object for each post.
-- hello ? --
The code: