Documentation
¶
Overview ¶
Package source provides constructors and methods for the HTML <source> element.
The <source> HTML element specifies multiple media resources for the <picture>, the <audio> element, or the <video> element.
Index ¶
- Variables
- func AudioMP3(src string) *element
- func AudioOgg(src string) *element
- func AudioWav(src string) *element
- func ImageAVIF(srcset string) *element
- func ImageWebP(srcset string) *element
- func New() *element
- func VideoMP4(src string) *element
- func VideoOgg(src string) *element
- func VideoWebM(src string) *element
- type Element
Constants ¶
This section is empty.
Variables ¶
var ( TagOpen = []byte("<source") AttrSrc = []byte(" src=\"") AttrType = []byte(" type=\"") AttrSrcset = []byte(" srcset=\"") AttrSizes = []byte(" sizes=\"") AttrMedia = []byte(" media=\"") AttrWidth = []byte(" width=\"") AttrHeight = []byte(" height=\"") )
Byte constants for HTML rendering.
Functions ¶
func AudioMP3 ¶
func AudioMP3(src string) *element
AudioMP3 creates an audio source element with MP3 type Example: source.AudioMP3("song.mp3") Renders: <source src="song.mp3" type="audio/mpeg" />
func AudioOgg ¶
func AudioOgg(src string) *element
AudioOgg creates an audio source element with Ogg type Example: source.AudioOgg("song.ogg") Renders: <source src="song.ogg" type="audio/ogg" />
func AudioWav ¶
func AudioWav(src string) *element
AudioWav creates an audio source element with WAV type Example: source.AudioWav("sound.wav") Renders: <source src="sound.wav" type="audio/wav" />
func ImageAVIF ¶
func ImageAVIF(srcset string) *element
ImageAVIF creates an image source element with AVIF type (for use in picture elements) Example: source.ImageAVIF("image.avif") Renders: <source type="image/avif" srcset="image.avif" />
func ImageWebP ¶
func ImageWebP(srcset string) *element
ImageWebP creates an image source element with WebP type (for use in picture elements) Example: source.ImageWebP("image.webp") Renders: <source type="image/webp" srcset="image.webp" />
func New ¶
func New() *element
New creates a new source element without any initial attributes. Example: source.New().Src("image.webp").Type("image/webp") Renders: <source src="image.webp" type="image/webp" />
func VideoMP4 ¶
func VideoMP4(src string) *element
VideoMP4 creates a video source element with MP4 type Example: source.VideoMP4("movie.mp4") Renders: <source src="movie.mp4" type="video/mp4" />