I am having an issue with a CSS dropdown menu, which you can see here: studio-scs.de.
Under one point only (portfolio) there is a dropdown menu leading to further points. The problem is I need those to be the same width like the PORTFOLIO button.
If I give that a fixed width like for example "width: 6.3rem;", it would look alright, but only as long as nobody has a different type installed on his computer, because those buttons are variable to its length, which makes them nicer to look at.
Let us say, someone has a different type installed, the width of 6.3 rem might not be the same amount like the space above (PORTFOLIO button).
Luckily the dropdown menu buttons/words are all shorter than portfolio. So, I think there might be a solution to this issue.
Here is the code used:
#nav {display: block; float: left; margin: 0 auto; width: 100%; font-size: 0.75rem;}
#nav ul, div.menu ul {list-style: none; margin: 0; padding: 0;}
#nav li, div.menu li {float: left; position: relative;}
#nav ul ul {display: none; position: absolute; top: 3.4rem; left: 0; float: left; width: auto; z-index: 99999;}
#nav a {color: #333; display: block; padding: 0 1.1rem; text-decoration: none; font-weight: normal; background: rgba(255, 255, 255, .7); margin: 0 0 0 2px;}
#nav ul li:hover > ul {display: block;}
#nav li:hover > a, #nav ul ul :hover > a {color: #888; background: rgba(255, 255, 255, .9);}
#nav ul ul a {background: rgba(255, 255, 255, .7); text-align: center; line-height: 1rem; width: inherit; padding: 10px 15px; height: auto; margin: 2px 0 0 2px}
#nav ul li.current_page_item > a, #nav ul li.current-menu-ancestor > a, #nav ul li.current-menu-item > a, #nav ul li.current-menu-parent > a {background: rgba(255, 255, 255, .8);}
The line that I put further into the field, is the line with the dropdown menu/options.
I tried to solve it with width: inherit;
, but that did not help either.