Class Img
Generate a standard HTML5 <img> tag
Implements
Inherited Members
Namespace: ToSic.Razor.Html5
Assembly: ToSic.Razor.dll
Syntax
public class Img : Tag<Img>, IRawHtmlString, IHtmlString, IHtmlTag, ITag, IEnumerable<ITag>, IEnumerable
Methods
| Improve this Doc View SourceAlt(String)
Set the alt attribute on the <img> tag
Declaration
public Img Alt(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | what should be in alt='...'. If called multiple times, later values replace the previous value. |
Returns
Type | Description |
---|---|
Img | a Img object to enable fluid command chaining |
Crossorigin(String)
Set the crossorigin attribute on the <img> tag
Declaration
public Img Crossorigin(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | what should be in crossorigin='...'. If called multiple times, later values replace the previous value. |
Returns
Type | Description |
---|---|
Img | a Img object to enable fluid command chaining |
Height(Int32)
Set the height attribute on the <img> tag
Declaration
public Img Height(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | what should be in height='...'. If called multiple times, later values replace the previous value. |
Returns
Type | Description |
---|---|
Img | a Img object to enable fluid command chaining |
Height(String)
Set the height attribute on the <img> tag
Declaration
public Img Height(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | what should be in height='...'. If called multiple times, later values replace the previous value. |
Returns
Type | Description |
---|---|
Img | a Img object to enable fluid command chaining |
Longdesc(String)
Set the longdesc attribute on the <img> tag
Declaration
public Img Longdesc(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | what should be in longdesc='...'. If called multiple times, later values replace the previous value. |
Returns
Type | Description |
---|---|
Img | a Img object to enable fluid command chaining |
Sizes(String)
Set the sizes attribute on the <img> tag
Declaration
public Img Sizes(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | what should be in sizes='...'. If called multiple times, later values replace the previous value. |
Returns
Type | Description |
---|---|
Img | a Img object to enable fluid command chaining |
Src(String)
Set the src attribute on the <img> tag Automatically url-encode it if contains spaces, umlauts or other unexpected chars
Declaration
public Img Src(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | what should be in src='...'. If called multiple times, later values replace the previous value. |
Returns
Type | Description |
---|---|
Img | a Img object to enable fluid command chaining |
Srcset(String)
Set the srcset attribute on the <img> tag Automatically url-encode it if contains spaces, umlauts or other unexpected chars
Declaration
public Img Srcset(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | what should be in srcset='...'. If called multiple times, later values replace the previous value. |
Returns
Type | Description |
---|---|
Img | a Img object to enable fluid command chaining |
Srcset(String, Int32)
Add another name/number pair to the srcset attribute on the <img> tag Automatically url-encode it if contains spaces, umlauts or other unexpected chars
Declaration
public Img Srcset(string name, int multiplier)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | image name |
System.Int32 | multiplier | what the images is for - numbers below 8 are used for resolution densities, larger numbers for pixel widths |
Returns
Type | Description |
---|---|
Img | a Img object to enable fluid command chaining |
Usemap(String)
Set the usemap attribute on the <img> tag
Declaration
public Img Usemap(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | what should be in usemap='...'. If called multiple times, later values replace the previous value. |
Returns
Type | Description |
---|---|
Img | a Img object to enable fluid command chaining |
Width(Int32)
Set the width attribute on the <img> tag
Declaration
public Img Width(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | what should be in width='...'. If called multiple times, later values replace the previous value. |
Returns
Type | Description |
---|---|
Img | a Img object to enable fluid command chaining |
Width(String)
Set the width attribute on the <img> tag
Declaration
public Img Width(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | what should be in width='...'. If called multiple times, later values replace the previous value. |
Returns
Type | Description |
---|---|
Img | a Img object to enable fluid command chaining |