gpt4 book ai didi

html - 我怎样才能使这两个元素不重叠或 "collide"?

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

所以我一直在使用 VideoJS 设置自己的流媒体页面,我现在想要的只是并排聊天,在本例中是一个 Twitch 聊天 iframe。 This is what I have now .

问题是聊天框下方的视频元素。我希望它在聊天框开始的地方结束,这样它们就可以很好地对齐。如果有人能帮我解决这个问题,我将不胜感激。

由于 Stackoverflow 迫使我也将代码放在这篇文章中,所以我想这是......

HTML:

<head>
<link href="//vjs.zencdn.net/4.9.0/video-js.css" rel="stylesheet">
<script src="//vjs.zencdn.net/4.9.0/video.js"></script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="//cdn.sc.gl/videojs-hotkeys/latest/videojs.hotkeys.min.js"></script>

</head>
<div id="sidebar-wrapper">
<iframe frameborder="0" scrolling="no" src="http://twitch.tv/test/chat?popout=" height="100%" width="350">
</iframe>
</div>
<div class="wrapper">
<div class="videocontent">
<video id="videostream" class="video-js vjs-default-skin vjs-big-play-centered vjs-fullscreen" controls width="auto" height="auto">
<source src="http://vjs.zencdn.net/v/oceans.mp4" type='video/mp4'>
</video>
<script>
videojs("videostream", {}, function(){
// Player (this) is initialized and ready.
});
videojs('videostream').ready(function() {
this.hotkeys({
volumeStep: 0.1,
seekStep: 5,
alwaysCaptureHotkeys: true
});
});
</script>
</div>
</div>

CSS:

.video-js {padding-top: 56.25%;
margin-right: 20px;
}
.vjs-fullscreen {padding-top: 0px}

#wrapper {
padding-left: 0;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}

#wrapper.toggled {
padding-left: 250px;
}

#sidebar-wrapper {
z-index: 10000;
position: fixed;
right: 250px;
width: 0;
height: 100%;
margin-right: -250px;

background: #000;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}

#wrapper.toggled #sidebar-wrapper {
width: 250px;
}

#page-content-wrapper {
width: 100%;
position: absolute;
padding: 15px;
}

#wrapper.toggled #page-content-wrapper {
position: absolute;
margin-right: -250px;
}

/* Sidebar Styles */

.sidebar-nav {
position: absolute;
top: 0;
width: 250px;
margin: 0;
padding: 0;
list-style: none;
}

.sidebar-nav li {
text-indent: 20px;
line-height: 40px;
}

.sidebar-nav li a {
display: block;
text-decoration: none;
color: #999999;
}

.sidebar-nav li a:hover {
text-decoration: none;
color: #fff;
background: rgba(255,255,255,0.2);
}

.sidebar-nav li a:active,
.sidebar-nav li a:focus {
text-decoration: none;
}

.sidebar-nav > .sidebar-brand {
height: 65px;
font-size: 18px;
line-height: 60px;
}

.sidebar-nav > .sidebar-brand a {
color: #999999;
}

.sidebar-nav > .sidebar-brand a:hover {
color: #fff;
background: none;
}

@media(min-width:768px) {
#wrapper {
padding-left: 250px;
}

#wrapper.toggled {
padding-left: 0;
}

#sidebar-wrapper {
width: 350px;
}

#wrapper.toggled #sidebar-wrapper {
width: 0;
}

#page-content-wrapper {
padding: 20px;
position: relative;
}

#wrapper.toggled #page-content-wrapper {
position: relative;
margin-right: 0;
}

#content
{
top: 0;
bottom: 0;
left: 0;
display: hidden;
}

最佳答案

您已将视频容器的 width 设置为 100%,因此它占用其容器(网页)的 width 的 100%。

您可以使用 calc 函数来获得预期的行为,因为您必须从 100% 的 width 中休息聊天的 width(350px) 容器。

#videostream{
width: calc(100% - 350px) !important;
}

Updated Codepen .

关于html - 我怎样才能使这两个元素不重叠或 "collide"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37586785/

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