如何并排调整 2 个嵌入元素的大小以及页面大小?

发布于 2025-01-09 16:23:09 字数 991 浏览 0 评论 0原文

如何并排嵌入这些内容并使它们也随页面调整大小,以便视频占据页面左侧的大约 70% 且聊天占据其他 30% %?

我还希望它们与页面一起调整大小,这样看起来总是不错。

我对 HTMLCSS 有点陌生,感谢专业人士的帮助。

<div class="topnav">
  <a href="index.html">Home</a>
  <a class="active" href="watch.html">Watch</a>
  <a href="https://pushpay.com/g/southknoxvillechurchofgod" target="_blank">Give</a>
  <a href="events.html">Events</a>
</div>


<div style="padding:56.25% 0 0 0;position:relative;"><iframe src="https://vimeo.com/event/1736206/embed" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe></div>

<iframe src="https://vimeo.com/event/1736206/chat/" width="100%" height="100%" frameborder="0"></iframe>

How do I embed these side by side and make them also resize with the page so that the video takes up about 70% of the left side of the page and the chat takes up the other 30%?

I also want them to resize as a group with the page so it always looks nice.

I am somewhat new to HTML and CSS, I appreciate any help from the pros.

<div class="topnav">
  <a href="index.html">Home</a>
  <a class="active" href="watch.html">Watch</a>
  <a href="https://pushpay.com/g/southknoxvillechurchofgod" target="_blank">Give</a>
  <a href="events.html">Events</a>
</div>


<div style="padding:56.25% 0 0 0;position:relative;"><iframe src="https://vimeo.com/event/1736206/embed" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe></div>

<iframe src="https://vimeo.com/event/1736206/chat/" width="100%" height="100%" frameborder="0"></iframe>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鹤舞 2025-01-16 16:23:09

将视频和聊天内容包装在 Flexbox 容器内,并分别自定义视频和聊天的宽度。请参阅下面的代码片段以供参考:

.container {
  display: flex;
}

.video-container {
  width: 70%;
}

.chat-container {
  width: 30%;
}
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Watch</title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="css/watch.css">
</head>
<body>
  <div class="topnav">
    <a href="index.html">Home</a>
    <a class="active" href="watch.html">Watch</a>
    <a href="https://pushpay.com/g/southknoxvillechurchofgod" target="_blank">Give</a>
    <a href="events.html">Events</a>
  </div>
  <div class="container">
    <div class="video-container" style="padding:56.25% 0 0 0;position:relative;"><iframe src="https://vimeo.com/event/1736206/embed" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe></div>
    <iframe class="chat-container" src="https://vimeo.com/event/1736206/chat/" frameborder="0"></iframe>
  </div>
</body>

</html>

Wrap the video and chat inside a flexbox container and customize the width for the video and chat separately. See the snippet below for your reference:

.container {
  display: flex;
}

.video-container {
  width: 70%;
}

.chat-container {
  width: 30%;
}
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Watch</title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="css/watch.css">
</head>
<body>
  <div class="topnav">
    <a href="index.html">Home</a>
    <a class="active" href="watch.html">Watch</a>
    <a href="https://pushpay.com/g/southknoxvillechurchofgod" target="_blank">Give</a>
    <a href="events.html">Events</a>
  </div>
  <div class="container">
    <div class="video-container" style="padding:56.25% 0 0 0;position:relative;"><iframe src="https://vimeo.com/event/1736206/embed" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe></div>
    <iframe class="chat-container" src="https://vimeo.com/event/1736206/chat/" frameborder="0"></iframe>
  </div>
</body>

</html>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文