This reference lane maps modern HTML/CSS UI idioms to Avalonia 11.3.12 XAML/C# patterns for:
Coverage intent for this lane:
controls/README.md,api-index-generated.md.width, height, margin, padding, border)block, inline, flex, grid)static, relative, absolute, stacking)px, rem, %, vw/vh, minmax, clamp)box-shadow, gradients, backdrop-like effects)hover, active, focus-visible)calc, min, max, clamp) and fluid sizing::before, ::after) and generated contentgrid-template-areas) and responsive area remappingmargin-inline, padding-block, inset-inline) and flow-aware spacingdir, direction, mixed-direction text flows)customElements, host attributes) to custom/templated controls<slot>, ::part) to ContentPresenter and template-part selectorsdata-* behavior metadata and custom DOM events (CustomEvent) to attached properties and routed events@layer, @scope, :has, @container) to style order, scoped selectors, class-state, and ContainerQuery<select>, <option>, multi-select) to ComboBox, ListBox, and SelectingItemsControlrole="switch", aria-checked="mixed") to ToggleSwitch, RadioButton, CheckBoxresize, col-resize, row-resize) to GridSplitter and ThumbRefreshContainer and RefreshVisualizerrole="tablist") to TabStrip + content host patternsTransitions/Animation.html-to-avalonia/README.md:
00-html-css-layout-box-model-and-positioning.md01-html-css-flexbox-grid-and-responsive-layout-recipes.md02-html-css-selectors-cascade-variables-and-theming.md03-html-css-animations-transitions-and-motion-system.md04-html-forms-input-and-validation-to-avalonia-controls.md05-html-shell-navigation-popups-and-layering-patterns.md06-html-rich-content-lists-cards-tables-and-virtualization.md07-html-css-design-system-utilities-and-component-variants.md08-html-css-to-avalonia-api-coverage-manifest-controls-layout-styling-animations.md09-html-css-typography-fonts-text-flow-and-truncation.md10-html-css-backgrounds-gradients-shadows-and-glass-patterns.md11-html-css-transforms-3d-and-micro-interaction-patterns.md12-html-css-interaction-states-focus-gestures-and-input-ux.md13-html-css-navigation-tabs-sidebars-breadcrumbs-and-routing-patterns.md14-html-css-modal-drawer-toast-and-overlay-system-patterns.md15-html-css-data-table-list-and-master-detail-patterns.md16-html-css-accessibility-semantics-and-motion-preference-mapping.md17-html-css-units-calc-clamp-and-fluid-sizing-patterns.md18-html-css-images-media-object-fit-and-aspect-ratio-patterns.md19-html-css-sticky-scroll-linked-and-anchor-patterns.md20-html-css-pseudo-elements-generated-content-and-decorative-layer-patterns.md21-html-css-grid-template-areas-to-avalonia-grid-region-patterns.md22-html-css-logical-properties-to-avalonia-flow-aware-spacing-and-alignment.md23-html-css-rtl-bidi-and-flow-direction-mapping.md24-html-css-buttons-links-toggle-and-split-command-surfaces.md25-html-css-details-accordion-and-treeview-hierarchical-disclosure.md26-html-css-range-progress-meter-and-scroll-feedback-controls.md27-html-css-advanced-input-autocomplete-date-time-mask-and-numeric-controls.md28-html-css-color-input-spectrum-and-theme-accent-controls.md29-html-css-tabs-offcanvas-and-carousel-shell-patterns.md30-html-css-menubar-dropdown-and-context-menu-command-surfaces.md31-html-web-components-custom-elements-to-avalonia-custom-and-templated-controls.md32-html-shadow-dom-slots-and-css-parts-to-avalonia-control-templates-and-themes.md33-html-data-attributes-custom-events-and-behaviors-to-avalonia-attached-properties.md34-html-css-cascade-layers-scope-and-has-state-to-avalonia-style-architecture.md35-html-css-select-option-multiselect-and-combobox-to-avalonia-selecting-controls.md36-html-css-switch-checkbox-radio-and-tristate-to-avalonia-toggle-controls.md37-html-css-resizable-split-panes-and-drag-handles-to-avalonia-gridsplitter-and-thumb.md38-html-css-pull-to-refresh-and-live-feed-patterns-to-avalonia-refreshcontainer.md39-html-css-headless-tablist-and-segmented-navigation-to-avalonia-tabstrip.mdFor exhaustive lookup (not just examples):
52-controls-reference-catalog.md and controls/README.md30-layout-measure-arrange-and-custom-layout-controls.md, 21-custom-layout-authoring.md04-styles-themes-resources.md, 16-property-system-attached-properties-behaviors-and-style-properties.md, 17-resources-assets-theme-variants-and-xmlns.md12-animations-transitions-and-frame-loops.md, 15-compositor-and-custom-visuals.mdapi-index-generated.mdHTML/CSS card:
<article class="card">
<h2>Revenue</h2>
<p class="value">$420,000</p>
</article>
.card {
padding: 16px;
border-radius: 12px;
background: #10151e;
border: 1px solid #283348;
}
.value {
font-size: 2rem;
font-weight: 700;
}
Avalonia XAML:
<Border Classes="card" Padding="16">
<StackPanel Spacing="6">
<TextBlock Classes="card-title" Text="Revenue" />
<TextBlock Classes="card-value" Text="$420,000" />
</StackPanel>
</Border>
<Style Selector="Border.card">
<Setter Property="CornerRadius" Value="12" />
<Setter Property="Background" Value="#10151E" />
<Setter Property="BorderBrush" Value="#283348" />
<Setter Property="BorderThickness" Value="1" />
</Style>
<Style Selector="TextBlock.card-value">
<Setter Property="FontSize" Value="32" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
Avalonia C#:
using Avalonia.Controls;
using Avalonia.Media;
var card = new Border
{
Padding = new Avalonia.Thickness(16),
CornerRadius = new CornerRadius(12),
Background = new SolidColorBrush(Color.Parse("#10151E")),
BorderBrush = new SolidColorBrush(Color.Parse("#283348")),
BorderThickness = new Avalonia.Thickness(1),
Child = new StackPanel
{
Spacing = 6,
Children =
{
new TextBlock { Text = "Revenue" },
new TextBlock { Text = "$420,000", FontSize = 32, FontWeight = FontWeight.Bold }
}
}
};
x:DataType in migrated views.Dispatcher.UIThread when triggered from background work.Grid + overlays.