我想在嵌入的视频和图片之间放一个列表,我不确定该怎么做。任何和所有的帮助将不胜感激。如果我做了一些不正确的问题,请告诉我。
谢谢
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title> Yui </title>
<style type="text/css">
h1,h2,h3,h4,h5,h6 {color:green; text-align:center;}
p {color:green;}
a {color:green; text-align:center}
hr {height:4px; background-color: black;width:100%;}
</style>
</head>
<body>
<h1> Yui </h1>
<hr>
<h2> <a href="http://www.yui-lover.com/">Yui's Fanpage <a>
 |
<a href="https://en.wikipedia.org/wiki/Yui_(singer)">Yui's Wiki </a>
 |
<a href="https://www.facebook.com/YUI.net.International?fref=ts"> Yui's Facebook </a>
</h2>
<hr>
<p>
<a href="http://n-jinny.com/wp-content/uploads/2013/11/YUI1.jpg">
<img style="float:right; border-color: transparent" src="http://n-jinny.com/wp-content/uploads/2013/11/YUI1.jpg" width="900" height="450" alt="Yui" > </a>
YUI is a Japanese singer-songwriter and J-pop/J-rock artist, born March 26, 1987 in Fukuoka, Japan. She sings, plays the acoustic guitar, and writes her own songs. YUI has written a vast number of theme/tie-up songs for popular Japanese drama/film, anime and commercial productions. She is the second female in Japanese music history that has achieved a record of four consecutive No 1. Singles since J-pop star, Utada Hikaru. She is currently signed with Gr8! Records Label, a sublabel under Sony Music Entertainment (Japan).
</p>
<iframe width="560" height="315"
src="https://www.youtube.com/embed/JmWf--kr4UQ" frameborder="0" allowfullscreen>
</iframe>
<ul style="list-style-type: circle">
<li>Goodbye Days </li>
<li>Again </li>
<li>Life </li>
</ul>
<hr>
</body>
</html>
答案 0 :(得分:0)
以下是您所做的一般概念:
<强> HTML 强>
<p class="clearfix">
test
<img src="http://placehold.it/350x150">
</p>
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
<iframe></iframe>
<强> CSS 强>
.clearfix:after {
content: "";
display: table;
clear: both;
}
img {
float: right;
}
说明:
p
是块级元素,因此它将占据整个宽度,下一个元素将显示在其下方。 ul
也是一个块级元素,因此它也将占据整个宽度,下一个元素将显示在它下面。 iframe
是内联元素,但由于它的父级是块级别,因此它将显示在其下方。
如果您在没有clearfix的情况下运行我的代码,它将无法运行。 ul
不会出现在图片下方。这是因为p
的高度并不反映img
(位于p
内)的高度。这是一个众所周知的问题,所以我会把你推荐给那些能够比我更好地解释它的人。可以这么说,使用clearfix将为您提供所需的结果。
切向建议: