多媒体文件无法使用<base>标记 HTML 加载


<!DOCTYPE html>
<html>
<head>
<!-- <base href="https://www.google.com"> -->
</head>
<body>
<img src = "/multimedia/FluencyGeek.PNG" >
<video src="/multimedia/Chand Wala Mukhda.mp4" controls autoplay></video>
<p>the <code style="background-color: #f1f1f1; color: green; padding: 2px; font-size: 105%; 
font-family: 'Courier New', Courier, monospace;"  >button</code> tag is best option</p>
</body>
</html>

我的代码工作,但如果取消注释

<base href="https://www.google.com">

则我的图像和视频无法加载。为什么?

基本标签指定图像源的初始地址。Google.com/multimedia没有提供图像或视频的准确地址。正如下面的例子所说,基本标签中的地址必须是精确的:

<!DOCTYPE html>
<html>
<head>
<base href="https://www.w3schools.com/" target="_blank">
</head>
<body>
<h1>The base element</h1>
<p><img src="images/stickman.gif" width="24" height="39" alt="Stickman"> - Notice that we have only specified a relative address for the image. Since we have specified a base URL in the head section, the browser will look for the image at "https://www.w3schools.com/images/stickman.gif".</p>
<p><a href="tags/tag_base.asp">HTML base tag</a> - Notice that the link opens in a new window, even if it has no target="_blank" attribute. This is because the target attribute of the base element is set to "_blank".</p>
</body>
</html>

最新更新