Creates a <source>
html tag.
source($src, $type, $media, $scrset, $sizes, $attr);
Parameter | Required | Default |
---|---|---|
$src | no | null |
$type | no | null |
$media | no | null |
$srcset | no | null |
$sizes | no | null |
$attr | no | null |
Depending on the type of source tag you are creating, (picture, audio, video, etc.), the attributes that you use will vary.
string
Usage:
echo source('podcast.mp3', 'audio/mpeg');
Result:
<source src="podcast.mp3" type="audio/mpeg">
Usage:
echo source(null, null, 'min-width:1200px', 'flower_lg.jpg');
echo source(null, null, 'min-width:100px', 'flower_sm.jpg');
Result:
<source srcset="flower_lg.jpg" media="min-width:1200px">
<source srcset="flower_sm.jpg" media="min-width:100px">