无法将此文本移至左侧
我试图将“大约 15 小时前”文本移至左侧,但无法似乎完成了。 float left 似乎不起作用,并且我无法减少左侧边距,因为“3 分钟前”文本将与图像发生冲突。
这是 html(抱歉搞得一团糟):
<div class="comment_column_narrow">
<div id="comment_title_39" class="comment_title">
Do you like this song?
<a href="/comment_titles/39" class="comment_title_delete" data-method="delete" data-remote="true" rel="nofollow">x</a>
</div>
<div class="comment_content">
<a href="/profiles/45" class="comment_image"><img alt="Justin meltzer" src="/system/photos/45/tiny/Justin Meltzer.jpeg?1302075215"></a>
<div class="textual_comment_content">
<div class="comment_text">
<span class="name_link">
<a href="/profiles/45" class="normal">Justin Meltzer</a>
</span>
Ok so this is what I think about this song: You need to switch back to your roots. You started as a rapper, and you need to remain a rapper. I respect you for your initiative to improve your flexibility but please stick to your roots. That's what makes you truly great.
</div>
<span class="comment_footer">
<ul>
<li class="list_style">about 15 hours ago.</li>
</ul>
<span>
</span></span></div></div></div>
这是相应的 CSS:
.comment_column_narrow {
float: left;
width: 295px;
margin-right: 5px;
}
.comment_content{
clear:both;
padding: 10px 5px;
border-top:2px solid #E2E2E2;
border-right:3px solid #E2E2E2;
}
.comment_text{
line-height: 120%;
}
.comment_image{
float:left;
margin-right: 10px;
}
.comment_footer{
}
.comment_footer ul{
margin-top: 5px;
}
.comment_footer ul li{
font-size: 10px;
color:gray;
float:left;
margin-right:25px;
}
.list_style{
list-style:none;
}
.name_link{
margin-left:-3px;
}
I'm trying to get the "about 15 hours ago" text to the left, but can't seem to get it done. float left doesn't seem to work, and I can't decrease the margin left because then the "3 minutes ago" text will collide with the image.
Here's the html(sorry for the big mess):
<div class="comment_column_narrow">
<div id="comment_title_39" class="comment_title">
Do you like this song?
<a href="/comment_titles/39" class="comment_title_delete" data-method="delete" data-remote="true" rel="nofollow">x</a>
</div>
<div class="comment_content">
<a href="/profiles/45" class="comment_image"><img alt="Justin meltzer" src="/system/photos/45/tiny/Justin Meltzer.jpeg?1302075215"></a>
<div class="textual_comment_content">
<div class="comment_text">
<span class="name_link">
<a href="/profiles/45" class="normal">Justin Meltzer</a>
</span>
Ok so this is what I think about this song: You need to switch back to your roots. You started as a rapper, and you need to remain a rapper. I respect you for your initiative to improve your flexibility but please stick to your roots. That's what makes you truly great.
</div>
<span class="comment_footer">
<ul>
<li class="list_style">about 15 hours ago.</li>
</ul>
<span>
</span></span></div></div></div>
And here's the corresponding CSS:
.comment_column_narrow {
float: left;
width: 295px;
margin-right: 5px;
}
.comment_content{
clear:both;
padding: 10px 5px;
border-top:2px solid #E2E2E2;
border-right:3px solid #E2E2E2;
}
.comment_text{
line-height: 120%;
}
.comment_image{
float:left;
margin-right: 10px;
}
.comment_footer{
}
.comment_footer ul{
margin-top: 5px;
}
.comment_footer ul li{
font-size: 10px;
color:gray;
float:left;
margin-right:25px;
}
.list_style{
list-style:none;
}
.name_link{
margin-left:-3px;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
而不是
这样:
将 comment_footer 范围移到 comment_text 范围内,以便它根据需要环绕图像。然后删除
和
,因为它们只会妨碍您。你最终会得到:
Instead of
this:
Move the comment_footer span INSIDE the comment_text span, so that it wraps around the image as you desire. Then remove the
<ul>
and<li>
as they are just getting in your way. You end up with:尝试将评论部分更改为:
Try changing to the comment section to this: