How to Add a Class and Reference it in a Control
CSS classes can be used to add additional styling to an control in Alpha Anywhere.
Custom CSS classes can be created and referenced in a control, client-side template, or any other HTML in a component.
On the design tab, click the 'Add Selector' button to add a new rule. Name the rule '.blueFont' to create a CSS class called 'blueFont' and click OK. In the right hand column, set the following properties:
- Font Size
- Font Weight
blue, #00f, or any shade of blue.
.blueFont is CSS syntax used to define a CSS class. Classes are assigned to an HTML element using the class attribute. For example: <div class="blueFont">Some text</div>
Click on the Code tab. This will show you the CSS that Alpha Anywhere created for the '.blueFont' selector. If you are comfortable editing CSS directly or would like to take advantage of Sass to create classes for you component, you can create and edit custom CSS and Sass on the code tab in the CSS Editor.
Click OK to save the new style definition(s).
The final step is to add the class to the desired control(s). On the builder pane where you add controls (Grid - Fields Pane; UX - Controls Pane), select the control to style. Locate the control's "class" property. Click the smart field button. Select the '.blueFont' class name from the list and click the Add button to add the class.
If you do not click the add button, the class is not added
You can alternatively type 'blueFont' into the Class property for the control.
Click OK to save the changes. Save the component. Then, open Live Preview to make sure the changes were applied.