为什么我的内容显示在div之外? [英] why is my content showing outside the div?
本文介绍了为什么我的内容显示在div之外?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个泡沫的内容,这是工作正常。现在,我想显示一个计数(2行),它应该始终在该div的右下角,在里面。我试过很多东西,但由于某种原因,它总是重叠的div和外面显示。我做错了什么?
I have a "bubble" with content, which is working fine. Now, I want to display a count (2 lines) which should always be in the bottom right corner of that div, INSIDE it. I tried many things but for some reason it always overlaps the div and shows outside. What am I doing wrong?
<style type="text/css">
body{
background-color:#f3f3f3;
}
.commentbox{
background-color: #ffffff;
width: 200px;
border-color: #D1D1D1;
border-radius: 4px;
border-style: solid;
border-width: 1px;
padding-bottom: 9px;
padding-left: 9px;
padding-right: 9px;
padding-top: 9px;
position:relative;
}
.count{
float:right;
text-align:right;
}
</style>
<div class="commentbox">
<div class="title">Some several lines long long long long content text goes here
</div>
<div class="count">123<br>456</div>
</div>
推荐答案
您浮动 .count
You are floating .count
so it doesn't influence it's parent container's height.
设置 overflow:hidden
( .commentbox
)或使用其他浮动包含技术之一,以便它。
Set overflow: hidden
on the parent (.commentbox
) or use one of the other float containing techniques so that it does.
这篇关于为什么我的内容显示在div之外?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文