Audio 隐藏的嵌入src仍然占用空间

Audio 隐藏的嵌入src仍然占用空间,audio,embed,hidden,Audio,Embed,Hidden,我有以下嵌入式代码: <embed src="audio/tileSelect.wav" autostart="false" width="1" height="1" hidden="true" id="sound1" enablejavascript="true"> <embed src="audio/tileRemove.wav" autostart="false" width="1" height="1" hidden="true" id="sound2" enablej

我有以下嵌入式代码:

<embed src="audio/tileSelect.wav" autostart="false" width="1" height="1" hidden="true" id="sound1" enablejavascript="true">
<embed src="audio/tileRemove.wav" autostart="false" width="1" height="1" hidden="true" id="sound2" enablejavascript="true">

虽然这些都是隐藏的(我没有看到),但它们仍然占据了空间。我如何删除他们使用的额外空间

我试着把它放在一个div中,带有
display:none,但这使我的音频无法工作

有什么建议吗

谢谢

嗯,我找到了一个解决方案(虽然不是很漂亮):


将它放在一个div中,并给出这些比例

接受的答案对我不起作用,当使用IE7-9时,屏幕上仍然有一个空白。我知道这是一篇老文章,自从给出这个答案后,浏览器已经改变了。将下面的代码保存为
audio.html
,并在IE7-10和最新版本的Chrome、Safari和FireFox中运行。您将看到,使用接受答案中的样式仍然会在屏幕上显示与IE7-9的差距。我使用的方法不适用

此外,我在可用时使用,然后在需要时返回到。我没有做过太多的研究,但这就是的内容,我已经测试了所有主要的浏览器和版本,截至2014年5月13日,它似乎对我非常有用

希望这有帮助

(音频可能需要一秒钟才能开始播放,它来自archive.org)


这是我正在使用的解决方案,因此嵌入标记不会占用任何空间…
音频嵌入在此块下方。在任何浏览器中都看不到间隙。 音频嵌入在该块的上方 使用带有“位置:相对;顶部:-50px;左侧:-50px;溢出:隐藏”的div,仍然会产生间隙…
音频嵌入在此块下方。你会在IE7-9中看到一个缺口。 音频嵌入在该块的上方
.au {
    position: relative; 
    top: -50px; 
    left: -50px; 
    overflow: hidden;
}
<div style="background-color:lightgray; height:100px; width:300px; padding:5px;">
    This is the solution I am using so that the embed tag doesn't take up any room...<br>
    Audio is embedded below this block.  You will see no gap in any browser.
</div>
<div style="position:absolute; top:0px; left:0px;">
    <audio autoplay>
        <source src="https://archive.org/download/testmp3testfile/mpthreetest.mp3" type="audio/mpeg">
        <embed width="1" height="1" hidden="true" src="https://archive.org/download/testmp3testfile/mpthreetest.mp3">
    </audio>
</div>
<div style="background-color:gray; height:20px; width:300px; padding:5px;">
    Audio is embedded above this block
</div>

<div style="background-color:aqua; height:100px; width:300px; padding:5px; margin-top:30px;">
    Using a div with "position: relative; top: -50px; left: -50px; overflow: hidden;" still gives a gap...<br>
    Audio is embedded below this block.  You will see a gap in IE7-9.
</div>
<div style="position: relative; top: -50px; left: -50px; overflow: hidden;">
    <audio autoplay>
        <source src="https://archive.org/download/testmp3testfile/mpthreetest.mp3" type="audio/mpeg">
        <embed width="1" height="1" hidden="true" src="https://archive.org/download/testmp3testfile/mpthreetest.mp3">
    </audio>
</div>
<div style="background-color:green; height:20px; width:300px; padding:5px;">
    Audio is embedded above this block
</div>