【发布时间】:2015-09-26 06:42:37
【问题描述】:
我正在尝试为我的 RoR 应用的主页实现响应式全背景视频。
目前,该视频只是显示为一个正在开发的黑色大空白屏幕。我决定将视频仅以一种格式 (mp4) 放入 vid.me,而不是通过 S3 或 AWS。
我的代码有什么问题还是我遗漏了什么?
谢谢!
app/assets/stylesheets/custom.css.scss
@import "bootstrap-sprockets";
@import "bootstrap";
/* mixins, variables, etc. */
$gray-medium-light: #eaeaea;
/* universal */
body {
padding-top: 60px;
}
section {
overflow: auto;
}
textarea {
resize: vertical;
}
.center {
text-align: center;
h1 {
margin-bottom: 10px;
}
}
/* typography */
h1, h2, h3, h4, h5, h6 {
line-height: 1;
}
@gray-light: #777;
h1 {
font-size: 3em;
letter-spacing: -2px;
margin-bottom: 30px;
text-align: center;
}
h2 {
font-size: 1.5em;
letter-spacing: -1px;
margin-bottom: 30px;
text-align: center;
font-weight: normal;
color: $gray-light
}
p {
font-size: 1.1em;
line-height: 1.7em;
}
/* header */
#logo {
float: left;
margin-right: 10px;
font-size: 1.7em;
color: #F0F8FF;
text-transform: uppercase;
letter-spacing: -1px;
padding-top: 9px;
font-weight: bold;
&:hover {
color: white;
text-decoration: none;
}
}
video {
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
background: url(https://vid.me/e/4UIS);
background-size: cover;
}
/* footer */
footer {
margin-top: 45px;
padding-top: 5px;
border-top: 1px solid $gray-medium-light;
color: $gray-light;
a {
color: $gray;
&:hover {
color: $gray-darker;
}
}
small {
float: left;
}
ul {
float: right;
list-style: none;
li {
float: left;
margin-left: 15px;
}
}
}
app
视频文件的代码当前在应用程序文件夹中,而不是 static_pages/home.html.erb 文件,因为由于某种原因不在 applicaiton.thml.erb 中时它会缩小:
app/views/application.html.erb
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
</head>
<body>
<video>
<source src ="https://vid.me/e/4UIS" type="video/mp4"/>
</video>
<%= render 'layouts/shim' %>
<div class="container">
<%= yield %>
<%= render 'layouts/footer' %>
</div>
</body>
</html>
【问题讨论】:
标签: css ruby-on-rails html video