【发布时间】:2015-06-02 17:37:15
【问题描述】:
我想尝试将其变成桌面平板电脑和手机的响应式设计,我很难让 youtube 视频响应式 - 有人可以帮忙吗?谢谢 真的很感激
我在想我需要对 CSS 进行某种媒体查询,但我不确定该怎么做 - 真的很感激,因为有人可以向我解释它是如何工作的
HTML:
.mytable {
margin-bottom: 20px;
font-family: "Helvetica", "Arial";
border: none;
border-radius: 3px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
}
.mytable td {
color: #22313F;
text-align: left;
border-radius: 0.75em;
font-weight: bold;
padding: 0.4em 2em 0.7em 1.15em;
text-shadow: 0 0 1px rgba(255, 255, 255, 0.1);
font-size: 0.9em;
}
.mytable tr {
-webkit-transition: background 0.3s, box-shadow 0.3s;
-moz-transition: background 0.3s, box-shadow 0.3s;
transition: background 0.3s, box-shadow 0.3s;
}
#container {
margin: 1em auto;
max-width: 1500px;
padding: 0;
text-align: center;
color: #22313F;
}
#principal,
aside {
border-radius: 1em;
display: inline-block;
margin: 0.25em auto;
max-width: 960px;
min-height: 200px;
padding: 0.65em;
text-align: center;
vertical-align: top;
width: 65%;
}
article {
background: #22313F;
border-radius: 0.5em;
min-height: 140px;
padding: 0.25em;
}
aside {
width: 30%;
}
<section id="container">
<section id="principal">
<article>
<iframe width="640" height="360" src="https://www.youtube.com/embed/RUina9K2Y8g?controls=0&showinfo=0" frameborder="0" allowfullscreen></iframe>
</article>
</section>
<aside>
<table class="mytable">
<tr>
<td></td>
<td style="background-color:#6C7A89"><font color=#FFF><font size="4">My List of Stuff</font>
</td>
</tr>
<tr>
<td>
<img src="https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-checkmark-outline-128.png" height="42" width="42">
</td>
<td>Filler One</td>
</tr>
<tbody>
<tr>
<td>
<img src="https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-checkmark-outline-128.png" height="42" width="42">
</td>
<td>Filler Two</td>
</tr>
<tr>
<td>
<img src="https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-checkmark-outline-128.png" height="42" width="42">
</td>
<td>Filler Three</td>
</tr>
<tr>
<td>
<img src="https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-checkmark-outline-128.png" height="42" width="42">
</td>
<td>Filler Four</td>
</tr>
<tr>
<td>
<img src="https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-checkmark-outline-128.png" height="42" width="42">
</td>
<td>Filler Five</td>
</tr>
</tr>
</tbody>
</table>
</aside>
</section>
【问题讨论】:
-
对于初学者,您将 iframe 设置为内联的固定像素值,而不是在 css 中定位它并使用 % 或任何其他动态值。
标签: html css mobile responsive-design media-queries