Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to vertically align two floated divs in a container div
    primarykey
    data
    text
    <p>I'm attempting to float two divs next to each other below a headline. I have tried inline-block, but the only luck I have had is making the container div display: table, and child divs as display: table-cell. I am able to align the two divs using this method, but now I have a large margin or extra padding above the "table cells." Any solution to remove extra margin/padding between the headline and child divs?</p> <p>If there is a solution to not using display: table and display: table-cell, I would greatly appreciate as I only defaulted to this, because I was unable to get the floats or inline-block to vertically align with each other.</p> <p><a href="http://jsfiddle.net/jasonniebauer/GRS2k/" rel="nofollow">http://jsfiddle.net/jasonniebauer/GRS2k/</a></p> <p><strong>HTML</strong></p> <pre><code>&lt;div id="owner_headline"&gt; &lt;h3&gt; Owner/Officer Information &lt;/h3&gt; &lt;p&gt; Second Owner/Officer (optional) &lt;/p&gt; &lt;/div&gt; &lt;div id="owner_info"&gt; &lt;div id="owner_info1"&gt; &lt;label for="owner_name"&gt; Name &lt;/label&gt; &lt;input type="text" id="owner_name" placeholder="Name"/&gt; &lt;label for="home_address"&gt; Home Address &lt;/label&gt; &lt;input type="text" id="home_address" placeholder="Address"/&gt; &lt;label for="owner_city"&gt; City &lt;/label&gt; &lt;input type="text" id="owner_city" placeholder="City"/&gt; &lt;label for="owner_state"&gt; State &lt;/label&gt; &lt;input type="text" id="owner_state" placeholder="State"/&gt; &lt;label for="owner_zip"&gt; Zip &lt;/label&gt; &lt;input type="text" id="owner_zip" placeholder="Zip"/&gt; &lt;label for="owner_phone"&gt; Phone &lt;/label&gt; &lt;input type="text" id="owner_phone" placeholder="Phone"/&gt; &lt;label for="ownership"&gt; Ownership &lt;/label&gt; &lt;input type="text" id="ownership" placeholder="Percentage"/&gt; &lt;label&gt; % &lt;/label&gt; &lt;label for="ssn"&gt; SSN &lt;/label&gt; &lt;input type="text" id="ssn" placeholder="XXX-XX-XXXX"&gt; &lt;/div&gt; &lt;div id="owner_info2"&gt; &lt;label for="owner_name2"&gt; Name &lt;/label&gt; &lt;input type="text" id="owner_name2" placeholder="Name"/&gt; &lt;label for="home_address2"&gt; Home Address &lt;/label&gt; &lt;input type="text" id="home_address2" placeholder="Address"/&gt; &lt;label for="owner_city2"&gt; City &lt;/label&gt; &lt;input type="text" id="owner_city2" placeholder="City"/&gt; &lt;label for="owner_state2"&gt; State &lt;/label&gt; &lt;input type="text" id="owner_state2" placeholder="State"/&gt; &lt;label for="owner_zip2"&gt; Zip &lt;/label&gt; &lt;input type="text" id="owner_zip2" placeholder="Zip"/&gt; &lt;label for="owner_phone2"&gt; Phone &lt;/label&gt; &lt;input type="text" id="owner_phone2" placeholder="Phone"/&gt; &lt;label for="ownership2"&gt; Ownership &lt;/label&gt; &lt;input type="text" id="ownership2" placeholder="Percentage"/&gt; &lt;label&gt; % &lt;/label&gt; &lt;label for="ssn"&gt; SSN &lt;/label&gt; &lt;input type="text" id="ssn2" placeholder="XXX-XX-XXXX"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>Css</strong></p> <pre><code>#owner_headline { background-color: #000B84; } #owner_headline h3 { background-color: #000B84; padding-left: 7rem; padding-top: .5rem; padding-bottom: .5rem; font-family: "Bank Gothic", serif; font-size: 24px; display: inline-block; color: #FFFFFF; } #owner_headline p { font-family: Arial, sans-serif; font-style: italic; font-size: 17px; font-weight: bold; display: inline-block; padding-top: 0; padding-bottom: 0; float: right; padding-right: .1rem; padding-top: .25rem; margin-right: 1rem; color: #FFFFFF; } #owner_info { width: 912px; display: table; } #owner_info1 { width: 446px; display: inline-block; border: 1px solid black; float: left; display: table-cell; } #owner_info2 { display: table-cell; } #owner_info1 label, #owner_info2 label { font-size: 14px; } #owner_info1 input, #owner_info2 input { display: inline-block; margin-bottom: 1rem; } #owner_info2 { margin-left: 1rem; width: 446px; display: inline-block; border: 1px solid black; float: left; } #owner_info1 input:nth-of-type(1), #owner_info2 input:nth-of-type(1) { width: 400px; } #owner_info1 input:nth-of-type(2), #owner_info2 input:nth-of-type(2) { width: 344px; } #owner_info1 input:nth-of-type(3), #owner_info2 input:nth-of-type(3) { width: 169px; } #owner_info1 input:nth-of-type(4), #owner_info2 input:nth-of-type(4) { width: 184px; } #owner_info1 label:nth-of-type(4), #owner_info1 label:nth-of-type(6), #owner_info1 label:nth-of-type(9), #owner_info2 label:nth-of-type(4), #owner_info2 label:nth-of-type(6), #owner_info2 label:nth-of-type(9) { margin-left: 1rem; } #owner_info1 input:nth-of-type(5), #owner_info2 input:nth-of-type(5) { width: 173px; } #owner_info1 input:nth-of-type(6), #owner_info2 input:nth-of-type(6) { width: 176px; } #owner_info1 input:nth-of-type(7), #owner_info2 input:nth-of-type(7) { width: 108px; } #owner_info1 input:nth-of-type(8), #owner_info2 input:nth-of-type(8) { width: 190px; } </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.
 

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