# Crafter.CppDOM A C++ DOM library for web applications that allows you to manipulate HTML elements directly from C++. ## New Styling Features This library now supports comprehensive styling capabilities beyond just inline HTML: ### Style Methods - `SetStyle(const std::string_view style)` - Sets multiple CSS properties at once - `SetProperty(const std::string_view property, const std::string_view value)` - Sets a single CSS property - `AddClass(const std::string_view className)` - Adds a CSS class to the element - `RemoveClass(const std::string_view className)` - Removes a CSS class from the element - `ToggleClass(const std::string_view className)` - Toggles a CSS class on the element - `HasClass(const std::string_view className)` - Checks if the element has a specific CSS class ### Example Usage ```cpp HtmlElement div("myDiv"); // Set multiple styles at once div.SetStyle("color: blue; font-size: 20px; background-color: lightgray;"); // Set individual properties div.SetProperty("border", "2px solid red"); div.SetProperty("padding", "10px"); // Work with CSS classes div.AddClass("highlight"); div.AddClass("container"); div.ToggleClass("active"); bool isActive = div.HasClass("active"); div.RemoveClass("highlight"); ``` ### Benefits 1. **Type Safety**: Compile-time checking of method names and parameters 2. **Performance**: More efficient than constructing HTML strings 3. **Maintainability**: Clear separation between content and styling logic 4. **Flexibility**: Support for both inline styles and CSS classes 5. **Developer Experience**: Intuitive API similar to JavaScript DOM ## Examples Check the examples directory for usage demonstrations: - `HelloWorld` - Basic usage - `HelloElement` - Creating and manipulating elements - `InteractiveElement` - Interactive elements with event handling - `AllEventHandling` - Complete event handling example - `StyleExample` - Demonstrates new styling features