jQuery Mobile: Header and content

This entry is part 43 of 73 in the series jQuery Mobile

In jQM, we can use ui-bar to create a full-width heading.

Add class ui-body to emphasize a section of content.

Additionally, classes ui-body-[a-z] add the appropriate swatch from your theme.

Header and Content
<!DOCTYPE html>
    <link href='http://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.min.css' rel='stylesheet'/>
    <script src='http://code.jquery.com/jquery-1.10.2.min.js'></script>
    <script src='http://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.min.js'></script>
<div data-role='page'>
    <div data-role='header'><h1>Grouping Content</h1></div>
    <h3 class='ui-bar ui-bar-a'>Heading</h3>
    <div class='ui-body'>
        <p>Lorem ipsum dolor sit amet...</p>

    <div data-role='footer' data-position='fixed'>

Try The Code

To add a slight change to the heading to have rounded corners.  We can add ui-corner-all.

Try The Code
Series Navigation<< jQuery Mobile: Inline only buttons using Icons
jQuery Mobile: Header and content with rounded corners >>

Leave a comment

Leave a Reply