Razor doesn’t understand unclosed html tags January 1, 2023 by Tarik Try like this: if (somecondition) { @:<div> }