Note that there are some explanatory texts on larger screens.

plurals
  1. POcenter text in div between two div (left and right)
    primarykey
    data
    text
    <p>I want to center the form elements in a div (horizontally and vertically). The whole div should be centered and is between a left and a right div.</p> <p><strong>Problems:</strong></p> <ul> <li>Through the padding the right div is misaligned.</li> <li>Also the text (Text1) is not correctly vertical aligned. -> padding-top works</li> <li>The whole content of the form is not horizontal aligned.</li> </ul> <p>Here is an <a href="http://jsfiddle.net/M5Nh5/" rel="nofollow">example</a>.</p> <p><strong>HTML:</strong></p> <pre><code>&lt;div id="top"&gt; &lt;div id="top-background-left"&gt;&amp;nbsp;&lt;/div&gt; &lt;div class="external"&gt; &lt;div class="externalinner"&gt; &lt;form id="form" name="form" method="post" action="action.html"&gt; &lt;p style="float: left; padding-right: 10px;"&gt;Text1&lt;/p&gt; &lt;input name="one" id="one" type="text" size="15" maxlength="10" /&gt; &lt;select name="no" size="1"&gt; &lt;option value="0"&gt;0&lt;/option&gt; &lt;option value="1"&gt;1&lt;/option&gt; &lt;option value="2" selected&gt;2&lt;/option&gt; &lt;option value="3"&gt;3&lt;/option&gt; &lt;option value="4"&gt;4&lt;/option&gt; &lt;option value="5"&gt;5&lt;/option&gt; &lt;/select&gt; &lt;button type="submit"&gt;Go&lt;/button&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="top-background-right"&gt;&amp;nbsp;&lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>CSS:</strong></p> <pre><code>#top{ padding: 0px; width: 100%; height: 66px; background-color: #efa910; z-index:12; position:fixed; overflow:hidden; } .externalinner { text-align: left; padding-top: 20px; } .external { background: #efa910; text-align:center; margin-left:auto; margin-right:auto; width:900px; } #top-background-left { background: white; width: 150px; height: 66px; float: left; } #top-background-right { background: white; width: 150px; height: 66px; float: right; } </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