RazorBlade Id, Title, Class(...) and Style(...) with SmartJoin
All html attributes can have the properties
id,
class,
style and
title.
So Tag objects have quick commands to set these. What makes it magical is that they always return the main object again, so you can chain them like
@Tag.Div().Id("wrapper").Class("alert").Class("alert-primary)
Note that some of these, like Id will replace the previous value, while others like Class will add new values to the attribute.
Imagine your code will add attributes step by step by using some kind of logic. In situations where you add more classes, they should be appended - like firstClass secondClass. Others should be appended with a special character like ; in styles because you want width: 75px; height: 25px. And others should replace the previous value - like id should always only have one value.