javascript - dialog body center pains -
i have dialog box im going turn manual entry dialog select box. having issues getting text/input box align vertically in center. here url if want view. select in select box , see, have made taller testing only. below dialog code. http://moconsultant.net , below css css used dialog alert system built mo
$('.selectbox').change(function(){ mydialogbox=" <div title='im manual entry box' class='dialogdiv'> manual entry:<input type='text' name='dialogname' id='dialogname' maxlength='40' class='dialoginput' ></div>" $(mydialogbox).dialog({ autoopen: true, width: 'auto', height: '500', modal: true, fluid: true, //new option buttons:[ { text: 'retun', 'class': 'return', click: function() { $(this).dialog( 'close' ); myfield.focus();myfield.select(); } } ], close: function() { } }); }); } /*mo alert*/ .ui-dialog .ui-dialog-titlebar { background-color: #0d3257; color: #ffffff; text-align: center; } .ui-dialog { border: 3px solid #0d3257; } .ui-dialog .ui-dialog-title { margin: .1em 16px .1em 0; text-align: center; float:none !important; } .ui-dialog .ui-dialog-content { border: none; background-color: #b0c4de; color: #00549e; padding: 0; vertical-align:text-middle; } .ui-button.continue{ color:green; font-family: arial; font-size: 12px; font-weight: bold; background-color:#f1f3f7; height:28px; width:150px; padding-bottom: 5px; border-style:outset; border-color:#9bb7d9; filter:progid:dximagetransform.microsoft.gradient (gradienttype=0,startcolorstr='#f1f3f7',endcolorstr='#e2eefd'); } .ui-button.continue:hover { color:blue; } .ui-dialog .ui-dialog-buttonpane { text-align: center; } .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: none; } .ui-button.return{ color:green; font-family: arial; font-size: 12px; font-weight: bold; background:#b0c4de; text-align:center; height:28px; width:150px; outline: none; border:0px; filter:progid:dximagetransform.microsoft.gradient (gradienttype=0,startcolorstr='#f1f3f7',endcolorstr='#e2eefd'); } .ui-button.return:hover { color:blue; } .ui-widget-header { background:#0d3257; border:0px; } .dialogdiv{ text-align:center; padding-top: 22px; /* can use padding vertically center*/ } .dialoginput{ height: 15px; }
here have demo on jsfiddle.net.
set css pseudo element wrapping div container, div id="ui-id-7"
, example. css pseudo element gets display: inline-block;
, height: 100%;
, vertical-align: middle;
. don´t forget content: '';
. wrap content aligned in div container , set 1 display: inline-block;
, vertical-align: middle;
.
by way, recommend use label
element input label. users able click on label set focus input field. works kind of input types.
html code:
<div class="dialogdiv ui-dialog-content ui-widget-content vertical-align-outer" id="ui-id-7" style="display: block; width: auto; min-height: 0px; max-height: none; height: 386px;"> <div class="vertical-align-inner"> <label for="dialogname">manual entry:</label> <input type="text" name="dialogname" id="dialogname" maxlength="40" class="dialoginput"/> </div> </div>
css code:
.vertical-align-outer:before { content: ' '; display: inline-block; height: 100%; vertical-align: middle; } .vertical-align-inner { display: inline-block; vertical-align: middle; }
Comments
Post a Comment