所以我有一个包含一些JS的HTML页面。
我有一个嵌入的YT视频插入与iframe和它下面的常规图像。在它们之间有一些空间,既不是来自iframe,也不是来自图像。(我尝试使用inspect工具选择它,它似乎来自父元素)。
这是一个屏幕截图,可以看到我正在谈论的内容:click
代码如下:
*reset.css*
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video, button {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
*main.css*
html {
height: 100%;
overflow-x:hidden;
}
@font-face {
font-family: 'Proxima Nova';
src: url("../fonts/Proxima\ Nova\ Bold.woff");
}
@font-face {
font-family: 'Proxima Nova Thin';
src: url("../fonts/Proxima\ Nova\ Thin.woff");
}
body {
background-color: #00558c;
font-family: 'Proxima Nova', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;
text-rendering: optimizeLegibility;
background-color: #0b101a !important;
color: #fff;
width: 100%;
height: 100%;
}
.container-site {
background-color: #0b101a !important;
}
.nav-index {
height: 100%;
}
.custom-color {
color: #FF7700 !important;
}
.nav-link {
font-size: 1.4rem !important;
}
.navbar-custom {
font-weight: bold;
}
.logo-carabella {
width: 9rem;
}
.logo-erasmus {
width: 9rem;
}
.float-right {
float: right;
}
.welcome-index {
height: 47rem;
position: relative;
}
.navbar {
-webkit-border-radius: 0 0 2.5rem 2.5rem;
-moz-border-radius: 0 0 2.5rem 2.5rem;
border-radius: 0 0 2.5rem 2.5rem;
}
::-webkit-scrollbar {
width: 6px;
background-color: #0b101a;
}
::-webkit-scrollbar-track {
display: none;
}
::-webkit-scrollbar-thumb {
background-color: #FF7700;
width: 10px;
}
.jumbotron-custom {
background-color: transparent !important;
color: #fff;
}
.lead-font {
font-family: 'Proxima Nova Thin', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;
}
.jumbotron-fluid {
z-index: 9999;
}
.container {
position: relative;
z-index: 9999;
}
.container-text-robot {
padding-top: 8rem;
}
.index-modificat-2 {
z-index: 1;
top: 20;
}
.index-modificat {
position:absolute;
top:0;
left: 0;
width:100%;
z-index: -1;
}
.video-prezentare {
text-align: center;
color: #fff;
}
.text-robot-1 {
width: 47rem;
}
.text-robot-2 {
width: 34rem;
}
.circuit-video {
width: 1024px;
}
#video-changer {
width: 600px;
height: 250px;
position: relative;
}
.hard-drive {
width: 100%;
position: absolute;
top: 0;
right: -600px;
z-index: 1;
}
.cd-video {
width: 65%;
position: absolute;
top: 3%;
right: -405px;
z-index: 2;
}
.slider-hard {
width: 50%;
position: absolute;
top: 4%;
right: -590px;
z-index: 3;
}
.sageata-change {
width: 2.5%;
position: absolute;
bottom: -60%;
right: -592px;
transform: rotate(180deg);
z-index: 3;
cursor: pointer;
}
.sageata-change-stanga {
width: 2.5%;
position: absolute;
bottom: -60%;
right: -23px;
z-index: 3;
cursor: pointer;
}
.container-site-fara-nav {
width: 1366px;
margin: 0 auto;
}
.instructor-sageti {
position: absolute;
top: 50%;
left: 35%;
width: 20rem;
}
.rotate-back {
transition: all 1s ease-in-out;
}
.rotate-fwd {
transition: all 1s ease-in-out;
}
@media only screen and (min-width: 768px) {
.navbar-brand {
margin-left: 2rem;
}
.navbar-custom {
position: absolute;
left: 50%;
transform: translatex(-50%);
}
.navbar-custom > li {
margin: 0 4rem;
}
}
@media only screen and (max-width: 767px) {
.logo-carabella {
display: none;
}
.logo-erasmus {
display: none;
}
.nav-link {
font-size: 1rem !important;
}
}
@media only screen and (min-width: 768px) and (max-width: 1100px) {
.navbar-custom > li {
margin: 0 2rem;
}
}
@media only screen and (min-width: 768px) and (max-width: 940px) {
.navbar-custom > li {
margin: 0 1rem;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="css/reset.css" type="text/css" rel="stylesheet">
<link href="css/css.css" type="text/css" rel="stylesheet">
<link href="css/bootstrap.min.css" type="text/css" rel="stylesheet">
<title>Made4Europe</title>
</head>
<body>
<div id="container-site">
<section class="nav-index">
<nav class="navbar navbar-expand-md navbar-light bg-light">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo01">
<a class="navbar-brand" href="#"><img src="img/logo.png" class="logo-carabella"></a>
<ul class="navbar-nav navbar-custom mr-auto mt-2 mt-lg-0">
<li class="nav-item active">
<a class="nav-link custom-color" href="#">Acasa<span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link custom-color" href="#">Lectii</a>
</li>
<li class="nav-item">
<a class="nav-link custom-color" href="#">Teste</a>
</li>
<li class="nav-item">
<a class="nav-link custom-color" href="#">Detalii</a>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="#"><img src="img/logo-erasmus.png" class="logo-erasmus"></a>
</div>
</ul>
</div>
</nav>
</section>
<div class="container-site-fara-nav">
<section class="welcome-index">
<div class="jumbotron jumbotron-fluid jumbotron-custom text-center">
<div class="container">
<div class="container-text-robot">
<img src="img/text.png" class="text-robot-1"/>
<img src="img/text 2.png" class="text-robot-2"/>
<object data="svg/Robot 1.svg" type="image/svg+xml" class="index-modificat"></object>
</div>
</div>
</div>
</section>
<section class="video-prezentare">
<iframe width="1024" height="768" src="https://www.youtube.com/embed/4OH3JZyLVJE" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<div id="wrapper-video-circuit">
<img src="img/video.png" class="circuit-video">
</div>
<div id="video-changer">
<img src="img/hard-drive.png" class="hard-drive">
<img src="img/cd.png" class="cd-video">
<img src="img/slider-hard.png" class="slider-hard">
<img src="img/sageata.png" class="sageata-change">
<img src="img/sageata.png" class="sageata-change-stanga">
<img src="img/instructor.png" class="instructor-sageti">
</div>
</section>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
</body>
</html>
这个空间是从哪里来的?我以为可能是图像的问题,但不是。它里面没有空间。
发布于 2019-03-14 02:19:32
给.video-prezentare
一个line-height: 0;
。
.video-prezentare {
text-align: center;
color: #fff;
line-height: 0;
}
https://stackoverflow.com/questions/55148670
复制相似问题