Example: Setting a CSS Property For a Group of Objects

Previous Next

Suppose, you want to provide some TextColumnControl objects on a web page with specific style characteristics. For example, you want a red background for all mandatory fields.

To implement this:

1.Group all required TextColumnControl objects within a new Group1 group object. See "How to Group Objects".
2.For the new Group1 object, set the Id property to: RedColorGroup.
3.Define the style sheet rule:

#RedColorGroup input.ColumnControl {
   background-color: red
}

 

This style sheet rule specifies that within the HTML element with ID: RedColorGroup, all input elements that belong to the ColumnControl class (all actual text boxes) get a red background color.

This style sheet rule is an example of a contextual selector.