Quick ReferenceStyle Guide - Palm webOS
by Mitch AllenMojo’s styling is automatically provided when you select the Mojo class names within your HTML, or use Mojo widgets. This appendix will help you determine the selectors or properties to change when you want to override the automatic styling. It’s best to use this style guide along with the StyleMatters sample application provided with the SDK.
This excerpt is from Palm webOS. This is the official guide to building native JavaScript applications for Palm's new mobile operating system, Palm® webOS™. Written by Palm's software chief technology officer along with the Palm webOS development team, Palm webOS offers you a complete tutorial on the design principles, architecture, UI, tools, and services necessary to develop webOS applications. If you're familiar with HTML, CSS, and Javascript, you're ready to build applications for webOS-based devices, including the Palm Pre.
Mojo’s styling is automatically provided when you select the Mojo class names within your HTML, or use Mojo widgets. This appendix will help you determine the selectors or properties to change when you want to override the automatic styling. It’s best to use this style guide along with the StyleMatters sample application provided with the SDK.
The guide is organized into several categories, including:
Scene Basics
List Basics
Containers
Dividers
Panels
Text
Widgets
Each category is presented in a table with:
A brief description
The filename of the CSS style sheet where the style category is defined
An HTML code sample using the style
A list of the base selectors that you can use in your CSS to override the framework’s styling
A list of optional selectors
Required child selectors, which must be embedded with the base selector for the style to be used effectively
These styles may be updated from time to time by Palm as part of an SDK update—you should check the SDK documentation to get the latest information.
global-base.css |
Change the background of an individual scene or every scene within the application.
Scene HTML |
|---|
<div class="my-backdrop"></div> |
Base selector | Optional selectors | Required child |
|---|---|---|
my-backdrop | ||
body |
Notes:
my-backdropis a developer-defined selector (you can define any selector name); this technique allows each individual scene to have a unique background.Use the
bodyselector to style the body element; a simple solution to style all of the scenes in your application.
global-lists.css |
The topmost element of the scrollable content; commonly used atop preference scenes.
Scene HTML |
|---|
<div class="palm-page-header multi-line">
<div class="palm-page-header-wrapper">
<div class="icon"></div>
<div class="title">
My title
</div>
</div>
</div> |
Base selector | Optional selectors | Required child |
|---|---|---|
.palm-page-header | .multi-line .icon | .palm-page-header-wrapper |
.palm-page-header-wrapper | ||
.palm-page-header-wrapper > .icon | ||
.palm-page-header-wrapper > .title | .left .center .right .truncating-text |
Notes:
palm-page-header-wrapperis a child element with a specified margin to compensate for the padding effect of-webkit-border-image.palm-page-header-wrapper > .iconshould be a 32 × 32px PNG centered on the div.
global.css |
A translucent layer used to obscure background UI when modal foreground UI is layered on top of the current scene.
In the absence of view or command menus, these fades at the edge of your scene indicate more content.
Scene HTML |
|---|
<div class="my-scene-fade-top" x-mojo-scroll-fade="top"></div> <div class="my-scene-fade-bottom" x-mojo-scroll-fade="bottom"></div> |
Base selector | Optional selectors | Required child |
|---|---|---|
None |
Notes:
Use a high z-index (100,000) if you want your fades to draw above all else, and use the style
-webkit-palm-mouse-target: ignore;to allow taps to pass through these fades to underlying content.
global-lists.css |
Rows stacked vertically within lists, designed for legibility and touch interaction.
Base selector | Optional selectors | Required child |
|---|---|---|
.palm-list | ||
.palm-row | .first .last .single .no-divider .no-separator .disabled | .palm-row-wrapper |
.palm-row-wrapper | .textfield-group | |
.palm-row-wrapper > .title | .left .right .truncating-text |
Notes:
.palm-row-wrapper: child element with a specified margin to compensate for the padding effect of-webkit-border-image.
global-lists.css |
global-lists.css |
The space revealed when you swipe to delete, which may contain confirmation buttons.
global-lists.css |
Displaying alternate background images and content styling in response to user interaction.
Scene HTML |
|---|
<div class="palm-row" x-mojo-touch-feedback="delayed">
<div class="palm-row-wrapper">
<!-- row content here -->
</div>
</div> |
Base selector | Optional selectors | Required child |
|---|---|---|
.palm-row.selected |
Notes:
When touched, rows using
x-mojo-touch-feedbackwill display a selection graphic implemented using-webkit-border-imagewith a 9-tile image (41 × 49 pixels).For items within scrollable content, use
delayedfeedback. For fixed elements that don’t scroll,immediatefeedback is an option. UseimmediatePersistentordelayedPersistentonly if you require exacting control of when feedback is removed (which must be done manually).
global-lists.css |
Displaying alternate background images and content styling in response to user interaction with rows within in a palm-group.
Base selector | Optional selectors | Required child |
|---|---|---|
.palm-group .palm-row.selected.first | ||
.palm-group .palm-row.selected.last | ||
.palm-group .palm-row.selected.single |
Notes:
global-dividers.css |
Divide a scene or list of rows with dividers that control corresponding drawers of content.
Base selector | Optional selectors | Required child |
|---|---|---|
.palm-divider.collapsible | .label .line .right |
global-dividers.css |
global.css and
global-buttons.css |
A modal panel pinned to the bottom of the scene.
Base selector | Optional selectors | Required child |
|---|---|---|
.palm-dialog-content | .palm-dialog-title .palm-dialog-separator .palm-dialog-message | |
.palm-dialog-title | .un-capitalize | |
.palm-dialog-buttons | .palm-button | |
.palm-dialog-separator | ||
.palm-dialog-message |
Notes:
Custom dialog box template with title, message, and buttons.
global.css |
Body copy and informational text.
Scene HTML |
|---|
None |
Base selector | Optional selectors | Required child |
|---|---|---|
.palm-text-wrapper | .palm-body-text | |
.palm-body-text | ||
.palm-body-title | ||
.palm-info-text | .single |
Notes:
.palm-text-wrapper: use this wrapper to contain multiple divs of styled text for proper padding.
global.css |
Some Mojo widgets and styles shift strings to uppercase or apply capitalization.
Notes:
Use
.capitalizefor CSS title case capitalization and.un-capitalizeto override autocapitalization in buttons, dialog box titles, and page headers.
global-base.css |
global-buttons.css |
global.css |
<div id="my-id" class="left" x-mojo-element="CheckBox"></div> |
Base selector | Optional selectors | Required child |
|---|---|---|
.checkbox | .left .right .disabled .true |
Notes:
Use the classes
.leftand.righton the widget when placing the check box into apalm-rowwithtitletext.
global-widget-mvpicker.css |
global-widget-mvpicker.css |
global-textfields.css |
global-menu.css |
global.css |
global.css |
global.css |
global.css |
global-textfields.css |
Base selector | Optional selectors | Required child |
|---|---|---|
.textfield-group | .focused .title .label |
global-widget-mvpicker.css |
If you enjoyed this excerpt, buy a copy of Palm webOS.
