Expand description
CSS Declaration Parser
This module provides parsing and representation for individual CSS declarations
(property-value pairs like color: red
or margin: 10px !important
).
§Main API
CSSDeclaration::from_string()
- Parse a CSS declaration from a stringCSSDeclaration::new()
- Create a new declaration programmaticallyDisplay
trait implementation for converting back to CSS string
§Examples
use css_structs::CSSDeclaration;
// Parse from string
let decl = CSSDeclaration::from_string("color: red !important").unwrap();
assert_eq!(decl.name, "color");
assert_eq!(decl.value, "red");
assert_eq!(decl.important, true);
// Create programmatically
let decl = CSSDeclaration::new("margin", "10px", None);
println!("{}", decl); // "margin: 10px;"