Why hidden input is affecting my layout? LF Explanation Why hidden input is affecting my layout? LF Explanation php php

Why hidden input is affecting my layout? LF Explanation


Is because you have a css rule (in bootstrap.min.css file) that match the firs-child element (but only if has a class*="span") inside the default_shipping_box div.

.row-fluid [class*="span"]:first-child {margin-left: 0;}

So, if you put your hidden input inside the div#default_shipping_box and before the first span, then that rule is not styling the div.span1 and thats why your template is been afected.

You can fixed adding a simple css rule to the same file...

.row-fluid .span1{margin-left:0 !important;}

The important, is because you have more files who overite this rule (ex. in bootstrap-responsive.min.css)

Good luck, and i hope it helpscheers,Gmo.-

EDIT:Too slow XD.Answered while writing ... I agree with the reason explained above.


Using Google Chrome's Inspest Plugin, when you move the input this class:

.row-fluid [class*="span"]:first-child {     margin-left: 0;}

Gets removed.

This is because in this:

<div id="shipping_box" class="formSep well">    <div id="default_shipping_box" class="shipping_box row-fluid">        <input type="hidden" name="tracking_id" value="" />        <div class="span1">        </div>    </div></div>

This : <div class="span1"> is not the first child, this: <input type="hidden" name="tracking_id" value="" /> is.

and in your CSS this is that default class for [class*="span"] is:

[class*="span"] {    float: left;    margin-left: 30px;}

So use this for example :

.row-fluid .span1 {    margin-left:0 !important;}

Hope this helps.


Bootstrap has some CSS that will set the left-margin of the first of the child to 0, if the class contains span:

.row-fluid [class*="span"]:first-child {    margin-left: 0;  }

When the hidden input is put above the first span div, the above margin-left: 0; property will not be applied.

The following image shows that when the hidden input is before, then the first span class has a left-margin.

Hidden input above DIV

This shows that when the hidden input is after the div, that there is no left-margin.

Hidden below above DIV

EDIT: I seem to have a been beaten twice, while I was getting the screenshots to illustrate the difference!