HTML新手 - 视频和表格干扰

时间:2017-04-14 18:06:34

标签: html css css3

所以我自己制作了我的第一个网站。我想要一个mp4视频,桌子就在视频的右侧。我让他们各自单独工作,但不能一起工作。

即当视频代码到位时,表格就会消失。我不擅长解释这个病,只是让你们自己看看。

<!DOCTYPE html>
<html>
<head>
<style>
*{font-family: Arial, Helvetica, sans-serif;}
body {margin:0;}


ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
width: 100%;    
}

li {
float: left;
border-right: 1px solid #bbb;
}

li:last-child {border-right: none;}

li a {
display: block;
padding: 14px 16px;
color: white;
text-align: center;
text-decoration: none;
}

li a:hover:not(.active) {
background-color: #111;
}

.active {
background-color: #808080;
border: 1px solid black;
}
table, td, th {border: 1px solid black;}

table {
border-collapse: collapse;
width: 50%;
}

th {
text-align: center;
height: 25px;
color:white;
background-color: #808080;
}

tr:hover {background-color: #f5f5f5}

td{text-align: left;}

th, td {
padding:15px;
text-align: left;
border-bottom: 1px solid #ddd;
}   
</style>
</head>
<body>

<ul>
  <li><a href="#home\home.html">Home</a></li>
  <li><a href="#profile\profile.html">Profile</a></li>
  <li><a href="#about">About</a></li>
  <li><a href="#matches">Matches</a></li>
  <li><a href="#highlights">Highlights</a></li>
  <li><a href="#setup">Setup</a></li>
  <li><a href="#shop">Shop</a></li>
  <li style="float:right"><a class="active" href="#contact">Contact</a></li>
</ul><br>
<hr>

<video width="200" height"500" autoplay loop>
    <source src="promo.mp4" type="video/mp4"
</video>
<hr><br>

<div style="overflow-x:auto;">
<table align="right">
    <tr>
        <th>Name</th>
        <th>Birth</th>
        <th>Nationality</th>
        <th>Team</th>
        <th>Role</th>
        <th>Rank</th>
        <th>Total Winnings</th>
        <th>Game(s)</th>
        <th>Past Teams</th>
    </tr>
    <tr>
        <td>qwerty</td>
        <td>wqert</td>
        <td>wqer</td>
        <td>wqer</td>
        <td>qwer</td>
        <td>qwer</td>
        <td>qwer</td>
        <td>qwer</td>
        <td>qwer</td>
    </tr>
</table>
</div>

</body>
</html>

我确定那里有很多新手的错误,这是预期的,不要太苛刻:) 我意识到视频不会出现在你的结尾,但可能会使用你自己的随机mp4? 非常感谢。

1 个答案:

答案 0 :(得分:-2)

我将你的代码转换成下面的小提琴试试。

https://jsfiddle.net/fmmnsw04/1/

更新:我会使用带有顶部和底部边框的ul,而不是横向规则<hr />标记,因为您可以更好地控制外观像边距,颜色和宽度。

我认为导致布局问题的其中一种风格是ul的位置:固定;

我更新了小提琴,因此视频和表格并排显示。以下是演示该要求的解决方案的部分:

<div>