Displaying Text and Hypertext

echohtml command is used to display text. echohtml also supports a subset of HTML (Hyper Text Markup Language) and CSS (Cascading Style Sheets) which allows you to format the output.

We have already seen how to use echohtml command in the Hello World Tutorial. Lets see how can we use inline CSS and display a table using echohtml. Copy and paste the following command and press enter.

echohtml <p align="center" style="font-family:arial;font-size:15pt">Following table shows hexadecimal values of colors <font color="red"><b>red</b></font>, <font color="green"><b>green</b></font> and <font color="blue"><b>blue</b></font>:</p> <table style="margin-top:10px" align="center" border=1 cellspacing=0 cellpadding=5><tr><th>Color</th><th>Hexadecimal value</th></tr><tr><td>Red</td><td>#ff0000</td></tr><tr><td>Green</td><td>#00ff00</td></tr><tr><td>Blue</td><td>#0000ff</td></tr></table>

You will see a similar output as shown in the image below:

echohtml example - FireCMD

Supported HTML tags

TagDescriptionComment
aAnchor or linkSupports the href and name attributes.
addressAddress
bBold
bigLarger font
blockquoteIndented paragraph
brLine break
centerCentered paragraph
codeCodeSame as tt.
ddDefinition data
dfnDefinitionSame as i.
divDocument divisionSupports the align (left, right, center, justify) attribute.
dlDefinition listSupports the align (left, right, center, justify) attribute.
dtDefinition termSupports the align (left, right, center, justify) attribute.
emEmphasizedSame as i.
fontFont size, family, and/or colorSupports the following attributes: size, face, and color.
h1Level 1 headingSupports the align (left, right, center, justify) attribute.
h2Level 2 headingSupports the align (left, right, center, justify) attribute.
h3Level 3 headingSupports the align (left, right, center, justify) attribute.
h4Level 4 headingSupports the align (left, right, center, justify) attribute.
h5Level 5 headingSupports the align (left, right, center, justify) attribute.
h6Level 6 headingSupports the align (left, right, center, justify) attribute.
hrHorizontal lineSupports the width attribute, which can be specified as an absolute or relative (%) value.
iItalic
imgImageSupports the src, width, and height attributes.
kbdUser-entered text
liList item
olOrdered listSupports the type (1, a, A, square, disc, circle) attribute.
pParagraphSupports the align (left, right, center, justify) attribute.
prePreformated text
sStrikethrough
sampSample codeSame as tt.
smallSmall font
spanGrouped elements
strongStrongSame as b.
styleStyle sheetAllows CSS to be included. A limited subset of CSS syntax can be used to change the appearance of the text.
subSubscript
supSuperscript
tableTableSupports the following attributes: border, bgcolor, cellspacing, cellpadding, width (absolute or relative), and height.
tdTable data cellSupports the width, bgcolor, colspan, rowspan, align (left, right, center, justify) and valign (top, middle, bottom) attributes.
thTable header cellSupports the width, bgcolor, colspan, rowspan, align (left, right, center, justify) and valign (top, middle, bottom) attributes.
trTable rowSupports the bgcolor attribute.
ttTeletype font
uUnderlined
ulUnordered listSupports the type (1, a, A, square, disc, circle) attribute.
varVariableSame as i.

Supported CSS Properties

PropertyValuesDescription
background-color<color>Background color for elements
background-image<uri>Background image for elements
color<color>Text foreground color
font-family<family name>Font family name
font-size[ small | medium | large | x-large | xx-large ] | <size>pt | <size>pxFont size relative to the document font, or specified in points or pixels
font-style[ normal | italic | oblique ]
font-weight[ normal | bold | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 ]
text-decorationnone | [ underline || overline || line-through ]Text effects
font[ [ <'font-style'> || <'font-weight'> ]? <'font-size'> <'font-family'> ]Font shorthand property
text-indent<length>pxFirst line text indentation in pixels
white-spacenormal | pre | nowrap | pre-wrapDeclares how whitespace in HTML is handled.
margin-top<length>pxTop paragraph margin in pixels
margin-bottom<length>pxBottom paragraph margin in pixels
margin-left<length>pxLeft paragraph margin in pixels
margin-right<length>pxRight paragraph margin in pixels
padding-top<length>pxTop table cell padding in pixels
padding-bottom<length>pxBottom table cell padding in pixels
padding-left<length>pxLeft table cell padding in pixels
padding-right<length>pxRight table cell padding in pixels
padding<length>pxShorthand for setting all the padding properties at once.
vertical-alignbaseline | sub | super | middle | top | bottomVertical text alignment. For vertical alignment in text table cells only middle, top, and bottom apply.
border-color<color>Border color for tables.
border-stylenone | dotted | dashed | dot-dash | dot-dot-dash | solid | double | groove | ridge | inset | outsetBorder style for tables.
background[ <'background-color'> || <'background-image'> ]Background shorthand property
float[ left | right | none ]Specifies where an image or a text will be placed in another element. Note that the float property is only supported for tables and images.
text-transform[ uppercase | lowercase ]Select the transformation that will be performed on the text prior to displaying it.
font-variantsmall-capsPerform the smallcaps transformation on the text prior to displaying it.

Note: Some HTML tags and CSS properties may also effect the prompt.


Documentation Index Page