I try to figure out a way to construct a layout for a menu as you can see in the picture below:
The Image represent a 100% width layout. Where the black bar extends over the full 100% width and the grey bar Is Illustrating the menu width: 960px! You could say make a wrapper; width: 100%; background: black; and within that wrapper the menu: width: 960px; background: grey; margin: 0 auto; But I don’t want the black background to appear under the menu, since I would like to work with a transparant :hover effect for the menu items. I tried it with display: inline-block, using three divs, but that wasn’t working. What would be the best way to make this work?
Since you have a gray background on the wrapper, the black won’t show through. So if you want the gray background to show behind, say, floated LIs, then set the UL to overflow: hidden;
The <li’s> will have the background (Grey) a you see it. On :hover thoughs they will be 50% transparant. I thought of having three divs within the wrapper. The middle one width: 960px and the two on each side. But I can’t define a width for the two side ones as you understand and I don’t want to set a background for the wrapper either, because than the hover won’t work since then the background from the wrapper is behind the <li’s> as well! This is what I thought: