Description
The FirstChild
field of the PseudoClass
enum represents the CSS pseudo-class :first-child
. This pseudo-class is used to select the first element among a group of sibling elements. It is part of the styling system in the Sandbox UI framework, allowing developers to apply specific styles to the first child element of a parent.
Usage
Use the PseudoClass.FirstChild
to apply styles to the first child element of a parent in your UI components. This can be particularly useful when you want to differentiate the styling of the first element from its siblings.
For example, you might want to add a specific margin or padding to the first child element to create a visual distinction.
Example
// Example of using PseudoClass.FirstChild in a UI component
public class MyCustomPanel : Panel
{
public MyCustomPanel()
{
// Apply a specific style to the first child element
StyleSheet.Load("styles/mycustompanel.scss");
}
}
// In your SCSS file (mycustompanel.scss)
.mycustompanel > :first-child {
margin-top: 10px;
padding: 5px;
background-color: #f0f0f0;
}