HTML and CSS

The control renders most types of XHTML element. The built-in WYSIWYM editor UI creates a subset of these elements; and you can use the API to extend this UI and create other elements. The CSS parser supports the standard stylesheet syntax, and the renderer supports the more important CSS properties.

HTML Elements

The following topics document the control's support for HTML elements:

XHTML Documents or Fragments

ModelText's HTML edit control is designed to parse, render, and edit XHTML only. It uses an XML reader to parse its input: it will not accept "tag soup" as input.

It supports a large subset of XHTML v1.1, whose DOCTYPE is as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

It can parse and render an entire document; or, it can also parse an XHTML document fragment, whose root is any block element: for example a <div> element, plus the child elements and text nodes which are valid embedded within the <div>.

Rendering

The Rendering column of the following table specifies whether the control is able to render these elements. In general, the control is able to render almost every type of XHTML element.

WYSIWYM Editing

The WYSIWYM Editing column of the following table specifies whether the built-in WYSIWYM UI is able to edit these elements. In general, the WYSIWYM UI supports editing all the most basic types of XHTML element, including:

In keeping with its being a simple WYSIWYM and not a WYSIWYG editor, the built-in UI doesn't support editing many of the less-used elements; but support for these elements could easily be added.

See also Sample Output for an example of the elements supported by the WYSIWYM editor.

API Only

In the following table, API Only means that support for editing this element is not built-in to the standard WYSIWYM UI, but that editing can be added as an application-specific extension, using the API. The API is mentioned in User Interfaces, and defined in APIs for the HTML Edit Control. There are examples of how to use the API, in the sample programs which are included with the Download.

In general, you can write an application-specific extension to edit any kind of element that the control is able is able to render.

Table of Supported Elements

The following table details the control's support for XHTML.

Module Rendering WYSIWYM Editing
Attribute Collections The class, id, and style attributes Supported API Only
'Events' attributes like onclick and onkeypress These attributes are ignored: your application installs event handlers using imperative .NET APIs, instead of declaratively.
Structure Module body, head, html, and title Supported API Only
Text Module br, h1, h2, h3, h4, h5, h6, and p. Supported Supported
abbr, acronym, address, blockquote, cite, code, dfn, div, em, kbd, q, samp, span, strong, and var. Supported API Only
pre. Not supported
Hypertext Module a. Supported API Only
List Module ol, ul, and li. Supported Support simple ordered and unordered lists; nested lists are via API Only.
dl, dt, and dd. Supported API Only
Text Extension Module b, big, del, i, ins, small, sub, sup, and tt. Supported API Only
bdo. Not supported.
Forms Modules form, input, label, select, option, and textarea. Supported. API Only
button, fieldset, legend, and optgroup. Not supported.
Table Modules table, tr, and td. Partially supported: the elements are supported, but the attributes are ignored; for example rowspan and colspan attributes are ignored, and the borders and so on can be specified via CSS but not using inline attributes. Supported
tbody, thead, tfoot, col, and th. API Only
caption and colgroup. Not supported.
The various other modules (including images and image maps, applets, objects, frames and targets) are not supported.

CSS Properties

The following topics document the control's support for CSS properties:

CSS Syntax and Grammar

The control parses CSS stylesheets, computes CSS property values, and applies the property values to the HTML elements which it renders.

You can use a sophisticated style sheet, because the control supports:

The only limitation is that the syntax of the CSS stylesheet must be valid: syntax checking is strict, and the Rules for handling parsing errors are not supported.

Supported Properties

ModelText's HTML edit control supports the subset of the CSS properties which configure:

The following table shows which subset of all CSS properties are currently implemented in the rendering (other CSS properties, if present in the stylesheet, are ignored).

Property Support
background-attachment, background-color, background-image, background-position, background-repeat, and background. Only background-color.
border-collapse Supported
border-color Supported
border-spacing Supported
border-style Only none or solid
border-width Supported
bottom Not supported
caption-side Not supported
clear Not supported
clip Not supported
color Supported
content Not supported
counter-increment, counter-reset Not supported
cursor Supported
direction Not supported
display Supports inline, block, list-item, table, none, and inline-block; not run-in or inline-table.
empty-cells Not supported
float Not supported
font-family, font-size, font-style, font-variant, and font-weight. Supported
height Not supported
left Not supported
letter-spacing Not supported
line-height Supported
list-style-image and list-style-position Not supported
list-style-type Only disc, circle, square, and decimal.
margin Supported
max-height, max-width, min-height, and min-width, Not supported
orphans Not supported
outline Not supported
overflow Not supported
padding Supported
page-break-after, page-break-before, page-break-inside Not supported
position Not supported
quotes Not supported
right Not supported
table-layout Not supported
text-align Supports left, right, and center; not justify.
text-decoration Supported
text-indent, text-transform Not supported
top Not supported
unicode-bidi Not supported
vertical-align Supported
visibility Not supported (but display:none is supported)
white-space Not supported
widows Not supported
width Supported
word-spacing Not supported
z-index Not supported

Sample CSS

The following is an example of a CSS file, which is included with the sample program in the Download and supported by the control:

/*
This file contains CSS rules which customize
the appearance of the HTML which is displayed.
You may alter the contents of this file.
*/

td
{ border-style: solid; border-width: thin;
padding: 0.5em 1em }

body, form
{ margin: 0 1.5em 1em; line-height: 1.33;
font-family: Calibri, Verdana, sans-serif;
font-size: 11pt; padding: 0 }
		  
P, BLOCKQUOTE, UL,
FIELDSET,
OL, DL, DIR,
MENU            { margin: 1em 0 }

OL, UL, DIR,
MENU, DD        { margin-left: 3em }

DT        { margin-left: 1.5em; font-weight: bold }

LI      { margin: 0.25em 0 }

/* some settings for O/S-specific form controls */

textarea,
select,
input,
input[type="text"]
{ border-style: solid; border-width: thin;
padding: 1px 2px }

ul.simple	{ list-style-type: none }

textarea	{ width: 100% }

h1, h2, h3, h4, h5, h6
{ font-family: Cambria, "Times New Roman", serif;
color: red }

h1
{ font-weight: bold; font-size: 14pt; }

h2
{ font-weight: bold; font-size: 13pt; }

h3
{ font-weight: bold; font-size: 11pt; }

h4
{ font-weight: bold; font-size: 11pt; font-style: italic }

h6
{ font-style: italic }

/*
show various non-standard background colors
ugly but a demonstration of how well they're painted
*/

body { background-color: fuchsia; }
p { background-color: #ffff80; }
a { background-color: silver; }
tr { background-color: aqua; }
td { background-color: silver; }
ul { background-color: #80ff80; }

/*
ensure that the selection always looks highlighted, i.e.
that it overrides all the default background colors
*/

:selection
{ background-color: Highlight !important;
color: HighlightText; }

.NET Components

About Us

News Summary

August 2012
New Product Roadmap.
October 2011
"Finally, a 100% managed .NET code HTML renderer. Only 6 years after I originally wanted it..."
February 2011
New Support and Licensing.
October 2010
Recent comments include:
"nice work. thanks"
"This component works fine."
"this is a fantastic control!"
August 2010
Also released a CSS Parser and Doc to HTML Converter.
June 2010
See Release notes for further updates.
June 2010
Added the Download page.
January 2010
First version of this web site.