I have a problem when transferring my app to phonegap. when I look the site in browser it appears normal, buttons are in line with text (even when i resize it to the size of the tablet im using), BUT when i try it on phonegap its messed up.
How it looks like (stackoverflow doesnt allow me upload images, my rep not 10) http://postimg.org/image/k49v615zz/
How it should look like
http://postimg.org/image/3t6g1a01p/
both screenshots are taken in the browser, but the first one has
display: inline-flex !important;
unticked, as u can see on the prntscr. Anyone had similar problem,any idea how to fix this?
index.js part with appending problematic buttons
if(value.countable==true){
$detailList.append("
<div id='countable'>
<span>"+value.detailName+"</span>
<div data-role='controlgroup' data-type='horizontal' data-mini='true'>
<button class='button detailRow qtyminus' id='minus' data-inline='true'>-</button>
<input type='number' class='qty' min='0' inputmode='numeric' pattern='[0-9]*' name=detail."+value.detailId+" id="+value.detailId+" value="+ ((value.quantity == null)? + " 0": value.quantity) +" />
<button class='button detailRow qtyplus' id='plus' data-inline='true'>+</button>
</div>").trigger("create");
}
CSS
#countable {
width:100%;
}
#countable span {
display: inline-block;
width: 19em;
}
#countable div {
display:inline-block;
}
.qty {
position:relative;
float:right;
width: 9em;
height: 3em;
text-align: center;
}
input.qtyplus {
position:relative;
float:right;
width:2em;
height:2em;
}
input.qtyminus {
position:relative;
float:right;
width:2em;
height:2em;
}
.workerRow, .categoryRow, .taskRow {
text-align: left;
}
Use % in elements.
CSS
#countable span {
display: inline-block;
width: 60%;
}
.qty {
position:relative;
float:right;
width: 30%;
height: 3em;
text-align: center;
}
input.qtyplus {
position:relative;
float:right;
width:5%;
height:2em;
}
input.qtyminus {
position:relative;
float:right;
width:5%;
height:2em;
}
Total elements space 100% of width
But try use this in your project, i used this to all my projects, is simple and efficient
CSS
*, *:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
outline: none;
}
.row:after {
content: '';
display: block;
clear: both;
}
.col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
float: left;
position: relative;
min-height: 1px;
padding-left: 15px;
padding-right: 15px;
}
.col-md-1 {
width: 8.33333333%;
}
.col-md-2 {
width: 16.66666666666667%;
}
.col-md-3 {
width: 25%;
}
.col-md-4 {
width: 33.33333333333333%;
}
.col-md-5 {
width: 41.66666666666667%;
}
.col-md-6 {
width: 50%;
}
.col-md-7 {
width: 58.33333333333333%;
}
.col-md-8 {
width: 66.66666666666667%;
}
.col-md-9 {
width: 75%;
}
.col-md-10 {
width: 83.33333333333333%;
}
.col-md-11 {
width: 91.66666666666667%;
}
.col-md-12 {
width: 100%;
}
How to use, is simple. Max size columns are 12.
Eg
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4"></div>
<div class="col-md-4"></div>
</div>
3 columns with size 4 * 3 = 12
To your problem use this
<div class="row">
<div class="col-md-6"></div>
<div class="col-md-1"></div>
<div class="col-md-4"></div>
<div class="col-md-1"></div>
</div>
The grid system are perfect, use this! (small demo http://jsfiddle.net/dieegov/Bk2gB/1/ )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.