Latest web development tutorials

jQuery Mobile Grid

jQuery Mobile Grid Layout

jQuery Mobile provides a breakdown of a CSS-based layout. However, on mobile devices, considering the phone's screen width narrow, generally we do not recommend the use of disaggregated column layout.

But sometimes you want smaller elements (such as buttons or navigation tabs) are arranged side by side together, like as in a table. In this case, it is recommended to use sub-column layout.

Grid columns are of equal width (total 100%), no border, background, margin or padding.

There are four layout grid are available:

Grid class Row Column Width correspond Examples
ui-grid-solo 1 100% ui-block-a try it
ui-grid-a 2 50% / 50% ui-block-a | b try it
ui-grid-b 3 33% / 33% / 33% ui-block-a | b | c try it
ui-grid-c 4 25% / 25% / 25% / 25% ui-block-a | b | c | d try it
ui-grid-d 5 20% / 20% / 20% / 20% / 20% ui-block-a | b | c | d | e try it

lamp In the column containers, sub-elements have class as ui-block-a | b | c | d | e depending on the number of columns. Floating row side by side.

Examples 1: class of ui-grid-a (two layouts), you must specify the ui-block-a and ui-block-b of the two sub-elements.

Examples 2: class of ui-grid-b (three layouts), you must add ui-block-a, ui- block-b and ui-block-c of the three sub-elements.


Custom Grid

By using CSS, you can customize column blocks:

Examples

<Style>
.ui-block-a, .ui-block-b, .ui-block-c {
background-color: lightgray;
border: 1px solid black;
height: 100px;
font-weight: bold;
text-align: center;
padding: 30px;
}
</ Style>

try it"

You can also customize using the inline style blocks:

<div class="ui-block-a" style="border: 1px solid black;"><span>Text..</span></div>

Multi-line

In the column, you can also have multiple lines.

Note: ui-block-a-class always create a new line:

Examples

<Div class = "ui-grid-b">
<Div class = "ui-block-a"> <span> some text </ span> </ div>
<Div class = "ui-block-b"> <span> some text </ span> </ div>
<Div class = "ui-block-c"> <span> some text </ span> </ div>
<Div class = "ui-block-a"> <span> some text </ span> </ div>
<Div class = "ui-block-b"> <span> some text </ span> </ div>
<Div class = "ui-block-a"> <span> some text </ span> </ div>
</ Div>

try it"

Responsive Grid

In the small screen, too much is not recommended in a row side by side button (text shortened).

We create a responsive grid for use in container ui-responsive categories:

Examples

<div class = "ui-grid -b ui-responsive">

try it"