简体   繁体   中英

Responsive text box jQuery mobile

I have label and text box in jQuery mobile and when the screen size changes the whole structure changes too.

When i have screen size width less then 448px it goes to label and text box under the label but when it is above 447px it is one next to the other.

I am adding two photos in order to be clear.

This is the code:

Html:

<div role="main" class="ui-content">
        <form>
            <div class="ui-field-contain">
                 <label for="sales1">Sales:</label>
                 <input type="text" id="sales" value="">
            </div>
</form>
</div>

Css:

.ui-field-contain .ui-input-text {
  width: 50% !important;
}

一个接一个

一个在另一个

Is there any way by css to override it and to be always one next to the other in any screen size?

You just have to style label as an block on small screens

@media (max-width: 448px) {
  .ui-field-contain label {
    display: block;
  }
}

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM