Let me illustrate an example here without using any provided styles or context, just showcasing in two different ways.
In this particular demonstration, I have introduced two unique custom tags.https://i.stack.imgur.com/1KY3W.png
Next, let's incorporate the following style guidelines.
<style>
.black-div {
height:40px;
width: 40px;
background-color: black;
}
</style>
These are the two tag assistants that correspond to the previously mentioned tags.
[HtmlTargetElement("div-with-class")]
public class ClassTagHelper : TagHelper
{
public override void Process(TagHelperContext context, TagHelperOutput output)
{
output.TagName = "div";
output.Attributes.SetAttribute("class", "black-div");
}
}
[HtmlTargetElement("div-with-style")]
public class StyleTagHelper : TagHelper
{
public override void Process(TagHelperContext context, TagHelperOutput output)
{
output.TagName = "div";
output.Attributes.SetAttribute("style", "height:40px;width: 40px;background-color: black;");
}
}
I hope this explanation is beneficial!