Domanda

This is embarrasing. Im making use of the Datebox module and I'm trying to align a label next to an input just like the examples in the provided link.

I'm expecting something along the lines of this: enter image description here

but get this: enter image description here

This is from my HTML:

<div name="activities" id="activities">
       <label for="activity-1">Activity 1</label>
       <input name="activity-1" id="activity-1" type="date" data-role="datebox" data-options='{"mode": "durationflipbox", "overrideDurationOrder": ["h","i"], "overrideDurationFormat": "%Dl:%DM"}'/>
</div>

I've tried setting styles in the CSS

#activities {
    display: inline-block;
    vertical-align: right;
}

but I'm not getting the expected result given above.

What am I doing wrong?

UPDATE It seems that HTML is being inserted when loading the page so the final result looks like this: enter image description here

I apologize for inserting an image instead of code, but I can't seem to copy the HTML in a legible way.

Anyway, here it is if you want to copy/paste it:

<div name="activities" id="activities">
        <label for="activity-1" class="ui-input-text" style="vertical-align: middle;">Activity 1</label>
        <div class="ui-input-text ui-shadow-inset ui-corner-all ui-btn-shadow ui-body-c"><div class="ui-input-datebox ui-corner-all ui-body-c" style="border: none;"><input name="activity-1" id="activity-1" type="text" data-role="datebox" data-options="{&quot;mode&quot;: &quot;durationflipbox&quot;, &quot;overrideDurationOrder&quot;: [&quot;h&quot;,&quot;i&quot;], &quot;overrideDurationFormat&quot;: &quot;%Dl:%DM&quot;}" class="ui-input-text ui-body-c" readonly="readonly"><a href="#" class="ui-input-clear ui-btn ui-btn-up-c ui-shadow ui-btn-corner-all ui-btn-icon-notext" title="Open Date Picker" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" data-icon="grid" data-iconpos="notext" data-theme="c" style="vertical-align: middle; display: inline-block;"><span class="ui-btn-inner"><span class="ui-btn-text">Open Date Picker</span><span class="ui-icon ui-icon-grid ui-icon-shadow">&nbsp;</span></span></a></div></div>
    </div>
È stato utile?

Soluzione 3

I've realised it is due to jQuery Mobile CSS.

Altri suggerimenti

Your code works for me: http://jsfiddle.net/Lera/HEeHd/ What browser are you using?

I can also get the same results without the CSS. Just your HTML:

<div name="activities" id="activities">
       <label for="activity-1">Activity 1</label>
       <input name="activity-1" id="activity-1" type="date" data-role="datebox" data-options='{"mode": "durationflipbox", "overrideDurationOrder": ["h","i"],     "overrideDurationFormat": "%Dl:%DM"}'/>
</div>

Try to set some styles to your label like this:

#activities label {
    position: absolute;
    top: 16px;
    left: 10px;
    z-index: 1;
}

Fiddle

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top