Skip to content

HTML elements ​

@triniwiz/nativescript-masonkit/web exports native counterparts of the common HTML elements. They are registered in every flavour by the framework setup, and their tags are lowercase:

html
<article class="post">
  <header>
    <h1>Release notes</h1>
    <p>Version 1.0 <small>(beta)</small></p>
  </header>
  <section>
    <p>Lists now draw <em>inside</em> markers. Try <code>list-style: inside</code>.</p>
    <blockquote>It just lays out like the web.</blockquote>
  </section>
  <footer><a href="https://github.com/triniwiz/nativescript-mason">Source</a></footer>
</article>

In plain NativeScript XML, use a namespace: xmlns:web="@triniwiz/nativescript-masonkit/web", then <web:div>, <web:p> and so on.

Elements come in two shapes:

  • Block elements (div, section, ul, form, ...) are containers. Each of them can scroll when its overflow says so, as any block box can in a browser. With the default overflow: visible they neither scroll nor clip.
  • Text elements (p, h1, span, a, li, ...) are built on Text: they hold text and inline content, and their children flow as one paragraph. See Text and inline content.

Block containers ​

div, section, header, footer, article, main, nav, aside, address, figcaption, hgroup, dt, form, fieldset, legend, picture.

All are display: block with no default margins or padding: the tag only carries meaning for your stylesheets. form, fieldset and legend are layout containers only; there is no form submission (see Forms).

Headings, paragraphs and preformatted text ​

h1-h6, p, blockquote, pre. Block-level text elements with browser margins, see Default styles.

Phrasing elements ​

Inline text elements. They differ only in their default styles:

TagDefault style
span, abbr, q, time, label, output, bdi, bdonone (plain inline text)
b, strongfont-weight: bold
em, i, cite, dfn, varfont-style: italic
codemonospace font
kbdfont-family: monospace; font-size: 0.9em
sampfont-family: monospace
smallfont-size: 0.8em
subfont-size: 0.75em; vertical-align: sub
supfont-size: 0.75em; vertical-align: super
u, instext-decoration: underline
s, deltext-decoration: line-through
markyellow background, black text
anone; href opens the link on tap (see Links)

<q>

<q> does not add quotation marks.

code uses the platform monospace face: ui-monospace (Menlo) on iOS, monospace on Android.

Other elements ​

TagNotes
figureBlock, margin: 16px 40px.
dlBlock, margin: 16px 0.
dtBlock.
ddBlock, margin-left: 40px.
hrBlock, zero height with a 1px solid top border, margin: 8px 0 (horizontal margins stay 0). Set border-top-color to colour it.
ul, ol, liSee Lists.
details, summarySee details and summary.
linkMetadata only: always display: none, never renders. Registered so code that creates one does not fail.

img, button, input, textarea and br are the MasonKit widgets of the same names.

Default styles ​

The full list of user-agent defaults. Lengths are CSS pixels (dips).

TagBaseDisplayFontMarginOther
block containers aboveblockblock
ptextblock16px 0
h1textblock32px bold21.44px 0
h2textblock24px bold19.92px 0
h3textblock19px bold18.72px 0
h4textblock16px bold21.28px 0
h5textblock13px bold22.18px 0
h6textblock11px bold24.98px 0
blockquotetextblock16px 40px
pretextblockmonospace16px 0white-space: pre
ulblockblock16px 0padding-left: 40px, list-style-type: disc
olblockblock16px 0padding-left: 40px, list-style-type: decimal
litextblocklist marker
figureblockblock16px 40px
dlblockblock16px 0
ddblockblock0 0 0 40px
hrblockblock8px 0height: 0, 1px solid top border
linkblocknone
phrasing elementstextinlinesee the table above

All of these sit below your stylesheets in the cascade: any rule for the same property wins, as it would over a browser's defaults. With preflight on, margins and padding start at 0 (heading font sizes stay) and <ul> has no markers.

Released under the Apache 2.0 License.