- NuGet: StylerCode.Css
Style html using C# codes.
Css style = new Css();
style.Add(Cp.Font_Size, FontVerseNumberSize);
style.Add(Cp.Font_Style, "italic");
style.Add(Cp.Font_Weight, "normal");
style.Add(Cp.Color, SystemAccentColor.ToHex());
style.Add(Cp.Transform, Cv.TranslateX("60px"));
var spn = $"<span {style.ToAttributeStyles()}>{verseNumber}</span>";
<div style="@verseStyle"></div>
Cast styles to string or vice-versa
public Css DrawerStyle { get; } = "height: 100%; width: 0; position: fixed; z-index: 1; top: 0; left: 0; background-color: #111; overflow-x: hidden;transition: 0.5s;padding-top: 60px;";
string cssValuesString = (Css)DrawerStyle;
Css myStyles = new Css();
myStyles.Add(Cp.Animation_Fill_Mode, "forwards").AddStyle(Cp.Color, "red");
myStyles.Add(Cp.Text_Decoration, Cv.Underline);
myStyles.Remove(Cp.Color);