Html

Employment/Purpose

The simplest way is to use an XUL component called htmlto embed whatever HTML tags you want to send directly to the browser. To avoid ZK from interpreting the HTML tags, you usually enclose them with and ]]>. In other words, they are not the child component. Rather, they are stored in the contentproperty. Notice you can use EL expressions in it.

Example

 <window id="win" title="Html Demo" border="normal">
     <html><![CDATA[
         <h4>Hi, ${win.title}</h4>
         <p>It is the content of the html component.</p>
     ]]></html>
 </window>

where <h4>...</p> will become the content of the html element (see also the getContent method of the org.zkoss.zul.Html class).

The html component generates the HTML SPAN tag to enclose the content. In other words, it generates the following HTML tags when rendered to the browser.

 <span id=”...”>
     <h4>Hi, Html Demo</h4>
     <p>It is the content of the html component.</p>
 </span>

Size issue

On Chrome, if

</code>'s sibling use `vflex` to set hight flexibly, developer must override `.z-html` CSS like this: ```css .z-html { display:block; } ``` or ```css .z-html { display: inline-block; } ``` Without this setting, `offsetHeight` of </code> will be zero, and sibling's height will be wrong. # Supported Events

Name

Event Type

None

None

- Inherited Supported Events: [ XulElement](/zk_component_ref/base_components/xulelement#Supported_Events) # Supported Children `*None` # Use Cases | Version | Description | Example Location | |---------|----------------------------------------------|------------------------------------------------------------------------------------------------------| | 3.6 | Work with HTML tags: The Html component | [The Html component](/zk_dev_ref/ui_patterns/html_tags/the_html_component) | | 3.6 | herf attribute in Html component | [<http://www.zkoss.org/forum/listComment/4745>](http://www.zkoss.org/forum/listComment/4745) | | 3.6 | Use Html component to escape HTML characters | [<http://www.zkoss.org/forum/listComment/11118>](http://www.zkoss.org/forum/listComment/11118) | # Version History | Version | Date | Content | |---------|------|---------| | | | |