Embed an MP3 music file onto an image

五迷三道 提交于 2019-12-12 02:27:11

问题


Good afternoon,

I have am image and I want to embed the MP3 file associated with the image into/onto the image, instead of having the MP3 under the image.

Is this at all possible.

Kind regards

Gary

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
</head>

<body>
<img src="Logoghp.jpg" width="224" height="134" alt=""/><br>
<audio controls>
  <embed src="Soul Train Easter 2016 Mke Vitti One Hour Mix Show.mp3" width="32" height="32"></embed>
</audio>
</body>
</html>

回答1:


Create a "container" div and, inside it, insert your image and an audio element (containing at least a source and a warning message for browsers that don't support it).

Give the "container" the same height of the image, assign the audio element "relative" position, then play with top and left values, e.g.:

.audio-container {
  height: 320px;
}
.audio-container audio {
  position: relative;
  top: -40px;
  left: 10px;
}
<div class="audio-container">
  <img src="http://www.battiato.it/wp-content/themes/battiato/images/about.jpg">
  <br>
  <audio controls>
    <source src="http://www.battiato.it/wp-content/uploads/mp3/joe/1-leoncavallo.mp3" type="audio/mpeg">
      Your browser does not support the audio element.
  </audio>
</div>


来源:https://stackoverflow.com/questions/35584888/embed-an-mp3-music-file-onto-an-image

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!