Html class
Bases: _Renderer
Page generator for HTML text.
Taipy can use HTML code to create pages that are the base of user interfaces.
You can find details on HTML-specific constructs and how to add Taipy Visual Elements in the section on HTML of the User Manual.
Methods¶
__init__() ¶
__init__(content: str, **kwargs) -> None
Initialize a new Html
page.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
content |
str
|
The text content or the path to the file holding the HTML text to
be transformed. |
required |
The Html
constructor supports the style parameter as explained in the
section on Styling and in the
set_style()
method.
create_page() ¶
create_page() -> t.Optional[Page]
Create the page content for page modules.
If this page is a page module, this method must be overloaded and return the page content.
This method should never be called directly: only the Taipy GUI internals will.
The default implementation returns None, indicating that this class does not implement a page module.
Returns:
Type | Description |
---|---|
Optional[Page]
|
The page content for this Page subclass, making it a page module. |
set_style() ¶
set_style(style: t.Dict[str, t.Dict[str, t.Any]]) -> Page
Set the style for this page.
The style parameter must contain a series of CSS rules that apply to the generated
page.
Each key of this dictionary should be a CSS selector and its associated value must be
a CSS declaration or a CSS rule itself, benefiting from
nested CSS
features.
For example, you could set the style parameter to:
{
"class1": {
"css_property1": "css_value1",
}
"class2": {
"class3": {
"css_property2": "css_value2",
}
}
}
Parameters:
Name | Type | Description | Default |
---|---|---|---|
style |
dict
|
A dictionary describing the style as CSS or Nested CSS. |
required |
Returns:
Type | Description |
---|---|
Page
|
This |