长文本在div之外 [英] Long text is outside of the div

查看:36
本文介绍了长文本在div之外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试建立一个测试网站,但是有一个问题.

I've trying to make a test website, but there is a problem.

这是一张图片,向您显示问题所在:

Here's is a picture, which show you, what's the problem:

年份(2010、2011、2012)是文件夹,"2013"​​文件夹包含一些图片.有一个php函数,我可以读取文件夹和图片名称.

The years (2010,2011,2012) are folders, and the '2013' folder contain some pictures. There's a php function, which I can read the folders and the picture names.

DOM结构:

        <div id="bottom">
        bhvdksakd
        </div>

CSS:

#main{
    max-width:22cm;
    min-width:16cm;
    background-color:#fff;
    margin:0px auto 20px auto;
    border-radius:10px;
    padding: 10px 10px 10px 10px;
    min-height:100%;
    position:relative;
    height:auto;
}
#left{
    display:block;
    width:20%;
    min-height:100%;
    position:absolute;
    margin:0px;
    top:0px;
    left:0px;
    border-right:1px solid rgba(192,192,192,0.5);
}
#right{
    display:block;
    min-height:100%;
    height:auto;
    width:80%;
    text-align:justify;
    position:absolute;
    top:0px;
    left:20%;
    padding:20px;
}
#bottom{
    max-width:22cm;
    background-color:#fff;
    margin:0px auto 0px auto;
    border-radius:10px;
}

是否有任何CSS方法或其他任何包含对象不在正确的" div之外的方法?

Is there any css method or anything, that the contain isn't outside of the "right" div?

谢谢!

ps:很抱歉,我来自匈牙利:/

ps: Sorry for my sentences, but I'm from Hungary :/

推荐答案

向您的CSS中添加 overflow:auto; 到具有溢出内容的div.

Add overflow: auto; to your CSS for the div with overflowing content.

此属性将仅在必要的轴上自动添加滚动条,以帮助将内容包含在div的边界内.因此,如果垂直内容过多,则会出现垂直(y)滚动条.如果水平内容过多,则会出现水平(x)滚动条.

This property will automatically add a scroll bar only on necessary axes to help contain content within the boundaries of the div. So if you have too much vertical content, you get a vertical (y) scrollbar. If you have too much horizontal content, you get a horizontal (x) scrollbar.

这篇关于长文本在div之外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆