CSS support

HTMLComponent supports WCSS which is a subset of CSS 2.0. It supports inline CSS directives, embedded CSS segments, and external CSS files. This topic lists the attributes supported in HTMLComponent.

Fully supported CSS properties

Background

background-color, background-image, background-repeat, background-attachment, background-position-x, background-position-y

Border

border-*-width, border-*-style, border-*-color

Fonts

font-family, font-size, font-style, font-weight, font-variant

Lists

list-style-image, list-style-position, list-style-type

Margins

margin-*, padding-*

Text

text-align, text-indent, text-transform

Misc

color, height, width, visibility

WAP

-wap-access-key, -wap-input-format, -wap-input-required

Shorthand properties

All shorthand properties are fully supported

* represents top, left, bottom, right

Partially supported properties

display

Supported: none, marquee

Unsupported: block, inline, list-item

white-space

Supported: normal, nowrap

Unsupported: pre

vertical-align

Works only within tables

Unsupported properties

clear, float

Known issues

  • width or height work for simple elements, but may be problematic with complex elements (for example tables).

  • font-family accepts the first mentioned font and ignores all fallback fonts, since finding a matching font is very time consuming, and also since in the ME environment usually there are not that many fonts anyway.

  • text-decoration is irrelevant: the only mandatory WCSS decoration value is 'none' which is usually used to remove underlines from links — since we do not have underlines, it has no meaning.

  • text-transform may have issues when overriding a parent which has a different transform.

  • Some properties are ignored if associated with a pseudo-class (such as a:focus or hover) — that is because while LWUIT does have separate styles for selected, unselected and pressed states, these styles include properties such as padding, margins, colours, background, font, but for example not alignment or visibility which would affect the component in all of its states.