Main Content

mlreportgen.dom.CSSProperty class

Package: mlreportgen.dom
Superclasses:

CSS property object for formatting HTML output

Description

Create a format object that specifies a cascading style sheet (CSS) property and value. Use the format object with mlreportgen.dom.CSSProperties to apply CSS properties to objects for HTML output. For information on CSS properties, see W3Schools.com/cssref/.

Note

Use CSSProperty objects only for formats not supported by DOM format object. Most DOM format objects work for any output type. Using CSSProperty objects makes your report application specific to HTML output.

Construction

prop = CSSProperty(Name,Value) creates a CSS format property that has the specified name and value.

Input Arguments

expand all

CSS property name, specified as a character vector.

Property value for the corresponding property name, specified as a character vector.

Output Arguments

expand all

CSS format object, returned as an mlreportgen.dom.CSSProperty object.

Properties

expand all

Children of this document element, specified as an array of DOM objects. This property is read-only.

ID for this document element, specified as a character vector or string scalar. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.

CSS property name, specified as a character vector.

Parent of this document element, specified as a DOM object. This property is read-only.

Tag for this document element, specified as a character vector or string scalar.

The DOM generates a session-unique tag as part of the creation of this object. The generated tag has the form CLASS:ID, where CLASS is the object class and ID is the value of the Id property of the object. Specifying your own tag value can help you to identify where an issue occurred during document generation.

Property value for corresponding property name, specified as a character vector.

Examples

collapse all

Create the CSSProperty objects inlist and outlist. When you create a list, you can use the CSSProperty object as a value to CSSProperties on the list.

import mlreportgen.dom.*

d = Document('List Styles','html');

inlist = CSSProperty('list-style-position','inside');
outlist = CSSProperty('list-style-position','outside');
p = Paragraph('The following list has list-style-position set to inside:');
append(d,p);

list = UnorderedList({'Earl Grey','Jasmine','Honeybush'});
list.Style = {CSSProperties(inlist)};
append(d,list);

p = Paragraph('The following list has list-style-position set to outside:');
append(d,p);
list = clone(list);
list.Style = {CSSProperties(outlist)};
append(d,list);

close(d);
rptview(d.OutputPath);
Introduced in R2016a