【发布时间】:2020-06-04 18:12:55
【问题描述】:
我的网页中间有一个视频供稿。我希望能够将其移至左侧。过去使用过 div 和 CSS 标签 position: absolute;左:60px;顶部:180 像素;我了解如何移动对象。出于某种原因,这似乎有所不同。它如何保持在页面中间是我的一大好奇心。
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="WebRTC code samples">
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1, maximum-scale=1">
<meta itemprop="description" content="WebRTC RPI-WebRTC-Stream Testing Page">
<meta itemprop="image" content="images/webrtc-icon-192x192.png">
<meta itemprop="name" content="Raspberry WebRTC Stream">
<meta name="mobile-web-app-capable" content="yes">
<meta id="theme-color" name="theme-color" content="#ffffff">
<base target="_blank">
<link rel="icon" sizes="192x192" href="images/webrtc-icon-192x192.png">
<link href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="css/main.css" />
</head>
<body>
<div id="container">
<video id="remoteVideo" autoplay playsinline controls muted width="100%" height="100%"></video>
<div>
<button id="Connect">Connect</button>
<button id="Disconnect">Disconnect</button>
</div>
</div>
<!-- <script src="js/lib/adapter.js"></script> -->
<script src="js/common.js"></script>
<!--
<script src="js/main_rws_orig.js"></script>
-->
<script src="js/sdputils.js"></script>
<script src="js/peerconnection_client.js"></script>
<script src="js/websocket_signaling.js"></script>
<script src="js/main_rws.js"></script>
<script src="https://webrtc.github.io/adapter/adapter-latest.js">
</body>
</html>
css 文件
/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree.
*/
.hidden {
display: none;
}
.highlight {
background-color: #eee;
font-size: 1.2em;
margin: 0 0 30px 0;
padding: 0.2em 1.5em;
}
.warning {
color: red;
font-weight: 400;
}
div#errorMsg p {
color: #F00;
}
}
a#viewSource {
display: block;
margin: 1.3em 0 0 0;
border-top: 1px solid #999;
padding: 1em 0 0 0;
}
div#links a {
display: block;
line-height: 1.3em;
margin: 0 0 1.5em 0;
}
div#links a {
display: block;
line-height: 1.3em;
margin: 0 0 1.5em 0;
}
div.outputSelector {
margin: -1.3em 0 2em 0;
}
@media screen and (min-width: 1000px) {
/* hack! to detect non-touch devices */
div#links a {
line-height: 0.8em;
}
}
audio {
max-width: 100%;
}
font-family: 'Roboto', sans-serif;
margin: 0;
padding: 1em;
word-break: break-word;
}
button {
background-color: #d84a38;
border: none;
border-radius: 2px;
color: white;
font-family: 'Roboto', sans-serif;
font-size: 0.8em;
margin: 0 0 1em 0;
padding: 0.5em 0.7em 0.6em 0.7em;
}
button:active {
background-color: #cf402f;
}
button:hover {
background-color: #cf402f;
}
button[disabled] {
color: #ccc;
}
button[disabled]:hover {
background-color: #d84a38;
}
canvas {
background-color: #ccc;
max-width: 100%;
width: 100%;
}
code {
font-family: 'Roboto', sans-serif;
font-weight: 400;
}
div#container {
margin: 0 auto 0 auto;
max-width:40em;
padding:
}
div#links {
padding: 0.5em 0 0 0;
}
html {
/* avoid annoying page width change
when moving from the home page */
overflow-y: scroll;
}
img {
border: none;
max-width: 100%;
}
input[type=radio] {
position: relative;
top: -1px;
}
p {
color: #444;
font-weight: 300;
line-height: 1.6em;
}
p#data {
border-top: 1px dotted #666;
font-family: Courier New, monospace;
line-height: 1.3em;
max-height: 1000px;
overflow-y: auto;
padding: 1em 0 0 0;
}
p.borderBelow {
border-bottom: 1px solid #aaa;
padding: 0 0 20px 0;
}
section p:last-of-type {
margin: 0;
}
section:last-of-type {
border-bottom: none;
padding: 0 0 1em 0;
}
select {
margin: 0 1em 1em 0;
position: relative;
top: -1px;
}
h1 span {
white-space: nowrap;
}
strong {
font-weight: 500;
}
textarea {
font-family: 'Roboto', sans-serif;
}
video {
background: #222;
margin: 0 0 20px 0;
width: 100%;
}
@media screen and (max-width: 650px) {
.highlight {
font-size: 1em;
margin: 0 0 20px 0;
padding: 0.2em 1em;
}
h1 {
font-size: 24px;
}
}
@media screen and (max-width: 550px) {
button:active {
background-color: darkRed;
}
h1 {
font-size: 22px;
}
}
【问题讨论】:
标签: javascript html css