Skip to content

html class

A visual element defined as an HTML tag.

Use this class to integrate raw HTML to your page.

This element can be used as a block element.

Methods

__init__()

__init__(*args, **kwargs)

Create a new html block.

Parameters:

Name Type Description Default
args any[]

A list of one or two unnamed arguments:

  • args[0] is the HTML tag name. If empty or None, this represents an HTML text node.
  • args[1] (optional) is the text of this element.
    Note that special HTML characters (such as '<' or '&') do not need to be protected.
()
kwargs dict[str, any]

the HTML attributes for this element.
These should be valid attribute names, with valid attribute values.

{}

Examples:

  • To generate <br/>, use:
    html("br")
    
  • To generate <h1>My page title</h1>, use:
    html("h1", "My page title")
    
  • To generate <h1 id="page-title">My page title</h1>, use:
    html("h1", "My page title", id="page-title")
    
  • To generate <p>This is a <b>Taipy GUI</b> element.</p>, use:
    with html("p"):
        html(None, "This is a ")
        html("b", "Taipy GUI")
        html(None, " element.")