<input style="@StyleForNumber(MyNumber)" type="number" @bind=MyNumber @bind:event="oninput" />
@code{
private string StyleForNumber(int n)
{
if (n > 100) return "";
if (n < 1) return "color:red";
return "background:lightgreen";
}
}