CSS rendering and document style

    Keep document CSS with the HTML when layout and formatting must survive export. Native Avalonia themes style the editing interface; document styles control the authored content.

    External stylesheets and resources still follow the editor resource policy.

    Actual styled HTML document within native Avalonia toolbars.
    Actual styled HTML document within native Avalonia toolbars.

    Use it in your application

    Use HeaderStyleContent for an owned document stylesheet and BodyStyle or default body properties for body-level styling.

    The example uses a class that your application supplies in the HTML. Test the document in its final destination because email clients and web pages have different CSS support.

    Avoid relying on a native control background or font setting to style exported HTML. Export the complete document when its head stylesheet is required.

    editor.HeaderStyleContent = ".notice { color: #1f3a5f; line-height: 1.5; }";
    await editor.SetBodyHtmlAsync(@"<p class=""notice"">Your document update is ready.</p>");
    string document = await editor.GetDocumentHtmlAsync();

    Continue with

    Last updated on Oct 18, 2026

    Put this into practice.

    Start with the C# Avalonia sample. Restore this edition's package and install the native browser prerequisites before running it.

    Prefer a guided look? Book a free live demo with our engineers - live on Zoom or Teams, never a chatbot.