Add background image to listview item

Description

The following code shows how to add background image to listview item.

Example


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.6.4.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.css">
<script type='text/javascript'
  src="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.js"></script>
<style type='text/css'>
.ui-icon-myapp-custom {<!-- w  ww.ja  v a 2 s . c o m-->
  background: url("http://placehold.it/30x30") no-repeat rgba(0, 0, 0, 0.4) !important;
}
</style>
</head>
<body>
  <div data-role="page" id="home">
    <div data-role="header">
      <a href="#user_info"> <img
        src="http://placehold.it/30x30" alt="custom buttom" />
      </a>
      <h1>Header</h1>
    </div>
    <div data-role="content">
      <ul data-role="listview" data-inset="true" data-theme="a"
        data-dividertheme="f">
        <li data-role="list-divider">Custom Icon</li>
        <li><a href="#" data-role="button" data-theme="b"
          data-iconpos="right" data-icon="myapp-custom"> Custom Icon </a></li>
      </ul>
    </div>
  </div>
</body>
</html>

Click to view the demo





















Home »
  jQuery Mobile »
    Example »




Button
Button Event
Button Icon
Button Text
Checkbox
Collapsible
Date
Dialog
Event
Footer
Form
Header
Icon
Input
Layout
Listview
Listview Divider
Listview Item
Loader
mobile_settings
Navbar
Page
Page Event
Popup
Radio
Select
Slider
Switch
Textarea
Theme