Css 在youtube评论部分对齐图像和评论,以获得响应性网站

Css 在youtube评论部分对齐图像和评论,以获得响应性网站,css,html,Css,Html,如何在一行中对齐图像和两个跨度 <img src="../images/profile/profile.png" class="img" /> <span class="name">Firt Name</span> <span class="comment"> This is simply dummy text of the printing and typesetting i

如何在一行中对齐图像和两个跨度

        <img src="../images/profile/profile.png" class="img" />
        <span class="name">Firt Name</span>
        <span class="comment">
            This is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently this is end of count.
        </span>
拨弄

我将图像和跨度显示属性更改为块等。。但仍然不起作用

尝试使用表格:

<table>
        <tr>
            <td><img src="http://i450.photobucket.com/albums/qq229/veraqueen/80X80-1.jpg" class="img" /></td>
            <td><span class="name">Firt Name</span></td>
            <td> <span class="comment">
                This is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently this is end of count.
            </span></td>
        </tr>
</table>

不确定这是否是您期望的行为,但…尝试以下方法:

CSS

为了使您的应用程序正常工作,您需要使用Float对每个类的宽度进行硬编码


如果您想让您的图像占据垂直空间,并保持名称和注释与其右侧对齐。你可以考虑做。

避免使用。对于更结构化的解决方案,您也可以使用引导

干杯

我刚才提到:

你忘了关闭css与; 您将以%表示的相对大小与以像素表示的绝对大小混合在一起。 实现我的代码,它会很好地工作。
p、 如果结果窗口没有显示在一行中,不要忘记将其向左移动

您希望如何对齐?同一行中的所有3个元素,左对齐、右对齐、居中对齐……?像这样?将display:inline块添加到包装器和display:block;这不允许它们并排浮动尝试删除宽度我希望图像占据所有垂直空间,并保持名称和注释向左对齐,表格是一种方法,但我们是否应该使用表格,我试图将“显示范围”属性更改为“表格单元格”,但dit不起作用。@Anonymous.X,与YouTube comments Section不起作用。这是一种响应行为,使其变得困难,否则就可以了,如果什么都不起作用,那么表格I是唯一的选择,因为YouTube也在使用表格
.wrapper {
    max-width:800px;
    margin:30px auto;
    background-color:#ccc;
    display:inline-block;
}
.img {
    width:80px;
    float:left;
    margin-right:15px
}
.name {
    float:left;
    width:80px;
}
.comment {
    float:left;
    width:600px;
}
.wrapper {
    max-width:800px;
    margin:30px auto;
    background-color:#ccc;
}
.img {
    width:80px;
    float:left;
    margin-right:15px
}
.name {
    float:left;
    width:100px;
}
.comment {
    float:left;
    width:605px;
}