Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 1.08 KB

File metadata and controls

38 lines (30 loc) · 1.08 KB

HtmlProperties

Constants for Html Attributes and Tag Names.

NuGet License: MIT

Instead of writing all the html tag names and/or attributes like this...

 // Create tag builder
 var builder = new TagBuilder("img")
 {
     TagRenderMode = TagRenderMode.SelfClosing
 };

 // Add attributes
 builder.MergeAttribute("src", "https://test.com/test.jpg");
 builder.MergeAttribute("alt", "test image");

use the contants...

 // Create tag builder
 var builder = new TagBuilder(HtmlTag.Img)
 {
     TagRenderMode = TagRenderMode.SelfClosing
 };

 // Add attributes
 builder.MergeAttribute(HtmlAttribute.Src, "https://test.com/test.jpg");
 builder.MergeAttribute(HtmlAttribute.Alt, "test image");