gpt4 book ai didi

html - Youtube 嵌入的 iFrame 未出现

转载 作者:行者123 更新时间:2023-11-28 10:44:44 24 4
gpt4 key购买 nike

今天我开始编写一个网页来演示我们的期末图形元素,我认为很简单的东西最终花了我好几个小时的时间。具体来说,我有一个无法正常工作的 YouTube 嵌入。这是页面的代码:

<?xml version = "1.0" encoding = "utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>3D OpenGL Chess Set</title>
<link rel="stylesheet" type="text/css" href="mainStyle.css">
</head>
<body>
<div id="banner" class="banner">
<h1> Welcome to the home of our OpenGL chess set! </h1>
</div>

<div id="wrapper" class="wrapper">

<div id="sidebar" class="menuBar">
<div id="ele1" class="menuElement"><a href="theTeam.html">The Team</a></div>
<div id="ele2" class="menuElement"><a href="theProject.html">The Project</a></div>
<div id="ele3" class="menuElement"><a href="contact.html">Contact</a></div>
<div id="ele4" class="menuElement"><a href="download.html">Download!</a></div>
</div>

<div id="mainContent" class="content">
<h1> Welcome, this is a webpage dedicated to our team's end of term project: a chess set designed using openGL and C++. </h1>
</div>

<div>
<iframe width="640" height="360" src="//www.youtube.com/embed/QGRW7YJa4cg" frameborder="0" allowfullscreen></iframe>
</div>

</div>

</body>
</html>

CSS 看起来像这样:

div.banner
{
display: flex;
align-items: center;
justify-content : center;

color:white;
font-size:large;

background-color:#606060;

height: 100px;
border: 10px groove black;
}

div.wrapper
{
height:1000px;

}

div.menuBar
{
color:white;
font-size:large;

float:left;

background-color:#606060;

width: 160px;
height: 1000px;
}

div.menuElement
{
display: flex;
align-items: center;
justify-content : center;

float:left;
color:white;
font-size:large;

width: 140px;
height: 180px;
border: 10px groove black;
}

div.content
{
display: flex;
justify-content : center;

color:Black;
}

p.center
{
font-size: xx-large;
text-align:center;
}

可以肯定这两者都没有问题,至少与 iFrame 无法正常工作的原因有关,但安全总比后悔好。我完全被难住了。所以这就是发生的事情,至少在我这边是这样。除播放器外,网页加载完美。那永远不会加载,我最终(以我的页面为例)谈论国际象棋的标题在其下方设置了一个空的内容 div。在使用检查元素选项之前,我什至没有得到播放器的边框。

如有任何帮助,我们将不胜感激!

问候, 格雷格

最佳答案

iframe 中尝试在 src 值上添加“https”,就像这样:

<iframe width="560" height="315" src="https://www.youtube.com/embed/QGRW7YJa4cg" frameborder="0" allowfullscreen></iframe>

关于html - Youtube 嵌入的 iFrame 未出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23036859/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com