html - 文本应始终位于图像框内

标签 html css

我有一个框,它是一个图像,图像中有文本,这些文本将被动态生成。

请查看随附的屏幕截图以获取更多信息。

当有更多文本时,如何确保图像拉伸(stretch)?

enter image description here

.my-community-box{
        background: url('/assets/my-community-box.png') no-repeat !important;
        background-size: 100%;
        width: 287px;
        min-height: 474px;
        float: right;

        .my-community-details{
            background-color: @mild-gray;
            margin: 20px 10px 10px 10px;
            padding: 5px;

            ul{
                width: 250px;
                margin: 0 0 9px 0;
                li{

                }
            }

            a{
                color: @darker-green;
            }

            a:hover{
                text-decoration: none;
                color: @light-green;
            }
        }

最佳答案

为什么不使用边框?

.my-community-box{
        background: #F3F3F2;
        width: 287px;
        min-height: 474px;
        float: right;
        border: 3px solid #C5C3C3;
}

.my-community-box-wrap{
        border-left: 2px solid #C2E2A0;
        border-right: 2px solid #C2E2A0;
        float: right;
}

演示:http://jsfiddle.net/AWXHr/

关于html - 文本应始终位于图像框内,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12818291/

相关文章:

css - 我无法在我的 div 背景中获取此图片

html - 如何解决这个重叠 div 问题并理解这个概念?

html - 如何向内容 div 添加 float 的后退和下一个按钮?

image - canvas draw图像质量

html - 无法将圆形按钮中的文本垂直居中

javascript - 如何根据元素的位置定位悬停 div

html - 为什么需要单击我的元素才能使 CSS 起作用?

css - 当滚动并将我的导航栏固定在顶部时,它有一个不稳定的运动效果

PHP自动生成新页面

JavaScript 不是数字