Note that there are some explanatory texts on larger screens.

plurals
  1. POcss - oversized div within small div
    primarykey
    data
    text
    <p>I need to make a menu that looks like this:</p> <p><img src="https://i.stack.imgur.com/FChKo.gif" alt="alt text"></p> <p>The upper entries need to have a right margin of (lets say) 20px.</p> <p>Problem arises, when I add the sub-menus, especially like the red one with the «large Menu-Entry». The top menu needs to stay in place and all the sub-menus need to be centered under that top menu. But either the top-entry is enlarged (which makes the green part shift to the right) or the sub-entries aren't positioned at the center of the top-entry... As the menu-entries are dynamic, I can't predict how wide they are and thus I can't apply any math.</p> <p>Also - the sub-entries are only visible, if the user is on the according page (means - the green part only shows «Menu1» if the user is on the red page)</p> <p>I «could» use some javascript to do it after the page loaded, but I'm trying to avoid that.</p> <p>I tried all sorts of stuff, including negative margins and whatnot - but nothing seems to work... Any ideas?</p> <p>[edit]</p> <p>some html here - tried to fumble around like crazy with no results (except the one from Brad, but that one doesn't work with IE)</p> <pre><code>&lt;div class="center"&gt; &lt;div class="menu-container"&gt; &lt;div class="menu-title"&gt;Title 1&lt;/div&gt; &lt;div class="menu-items"&gt; Testomat&lt;br /&gt; Yo, this is a long text &lt;/div&gt; &lt;/div&gt; &lt;div class="menu-container"&gt; &lt;div class="menu-title"&gt;Title 1&lt;/div&gt; &lt;div class="menu-items"&gt; Testomat&lt;br /&gt; Yo, this is a long text &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>CSS: </p> <pre><code>.menu-container{ width: 100px; float: left; } .menu-items, .menu-title{ text-align: center; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload