I have following code:
li.hMenu {
background: red;
width: 33.33%; /*for the older browsers fallback */
width: calc(100% / 3);
height: 100%;
float: left;
}
li.hMenu:hover{
background-color: darkred;
}
li.hMenu:active{
position: relative;
left: 1px;
top: 1px;
background-color: darkred;
}
#menu {
width: 100%;
overflow: hidden;
margin: 0;
padding: 0;
list-style-type: none;
border: 1px solid black;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="CommonLayout.css" />
<script src="ProjectPage.js"></script>
</head>
<body>
<ul id="menu">
<li style="z-index: 10" class="hMenu">
<a href="ProjectPage.html">Main Page</a>
</li>
<li style="z-index: 9" class="hMenu">
<a href="About.html">About</a>
</li>
<li style="z-index: 8" class="hMenu">
<a href="Calculator.html">Calculator</a>
</li>
</ul>
<p>This is <em>Main Page</em> page.</p>
</body>
</html>
And when I make browser window small enough, then text of first element of the menu is shown in two lines, thus making this menu element bigger than the others. Also containing <div>
expands. I thought, if I specify height: 100%
it would make other menu items adjust, but it didn't change anything.
How can it be achieved?
`, then if menu item becomes bigger, it will result in an overflow. Now, the `
– Michał Turczyn Apr 22 '18 at 08:57` element somehow adjust itself to the "highest" child. I just want the rest of children to adjust to their "sibling".