CSS元素之间的随机空间 [英] CSS Random space between elements
问题描述
我最近开始在我自己的视频播放器上工作,但是,我似乎无法分辨出我的视频元素和我的div元素之间的空间来自这里是我所指的是什么的图像。 http://i.imgur.com/PfRT05j.png (无法发布图片,我必须发布一个链接)
我的造型:
*
{
padding:0;
保证金:0;
}
div#player_container
{
宽度:1280px;
margin:0 auto;
}
video
{
background-color:#000;
}
div#player_controls
{
position:relative;
宽度:100%;
height:40px;
background-color:#383B42;
}
div#player_seekbar
{
position:absolute;
宽度:100%;
height:10px;
背景颜色:#3066DB;
z-index:2;
}
div#player_buffered_bar
{
position:absolute;
宽度:100%;
height:10px;
background-color:#DEDEDE;
z-index:1;
}
这是我的html文档:
<!DOCTYPE html>
< html>
< head>
< title> Player - 版本:0.1a< / title>
< link rel =stylesheettype =text / csshref =stylesheet.css>
< script type =text / javascriptsrc =jquery-1.11.1.min.js>< / script>
< script type =text / javascriptsrc =script.js>< / script>
< / head>
< body>
< div id =player_container>
< video id =playerwidth =1280height =720>
< source src =test_video.mp4type =video / mp4>
< source src =test_video.oggtype =video / ogg>
您的浏览器不支持视频标记。
< / video>
< div id =player_controls>
< div id =player_seekbar>< / div>
< div id =player_buffered_bar>< / div>
< / div>
< / div>
< / body>
< / html>
非常感谢您的任何帮助。
baseline
你可以 vertical-align
它与中间
或更容易让所有< video>
s块元素:
video {
display:block;
}
i've recently started working on my own video player for fun however, I can't seem to tell where this space between my video element and my div elements is coming from here is an image of what i'm referring to. http://i.imgur.com/PfRT05j.png (Can't post an image so I had to post a link to it)
My styling:
*
{
padding: 0;
margin: 0;
}
div#player_container
{
width: 1280px;
margin: 0 auto;
}
video
{
background-color: #000;
}
div#player_controls
{
position: relative;
width: 100%;
height: 40px;
background-color: #383B42;
}
div#player_seekbar
{
position: absolute;
width: 100%;
height: 10px;
background-color: #3066DB;
z-index: 2;
}
div#player_buffered_bar
{
position: absolute;
width: 100%;
height: 10px;
background-color: #DEDEDE;
z-index: 1;
}
Here is my html document:
<!DOCTYPE html>
<html>
<head>
<title>Player - Version: 0.1a</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<div id="player_container">
<video id="player" width="1280" height="720">
<source src="test_video.mp4" type="video/mp4">
<source src="test_video.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
<div id="player_controls">
<div id="player_seekbar"></div>
<div id="player_buffered_bar"></div>
</div>
</div>
</body>
</html>
Any help is much appreciated.
Your <video>
is a inline element which has a vertical-align by default (baseline
).
You can either vertical-align
it with middle
or easier make all <video>
s block elements:
video {
display: block;
}
这篇关于CSS元素之间的随机空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!