【发布时间】:2013-08-10 03:01:58
【问题描述】:
我正在创建一个“圆角”容器,用于自定义弹出窗口和工具提示。最初,我使用 3x3 表格和圆角 png 作为角落内容。
这些圆形 png 为 24x24,您可以看到它如何立即为我的内部内容强制设置 24 像素的边距。我想将标记转换为 Divs 以获得更多的边距/填充灵活性。
我真的希望顶部的 24 像素渐变具有专业外观。我几乎完成了 Div 容器,但我遇到了一个硬树桩!我无法让容器 div 动态扩展以包含子内容!到目前为止,这是我的代码。为了您的清楚起见,我删除了背景图片并用简单的背景颜色替换了它们。
<div id="container" style="position: absolute; width: 200px; height: 100px;">
<div id="topLeft" style="background-color: Aqua; position: absolute; width: 24px;
height: 24px; top: 0px; left: 0px;">
</div>
<div id="topRight" style="background-color: Aqua; position: absolute; width: 24px;
height: 24px; top: 0px; right: 0px;">
</div>
<div id="bottomLeft" style="background-color: Aqua; position: absolute; width: 24px;
height: 24px; bottom: 0px; left: 0px;">
</div>
<div id="bottomRight" style="background-color: Aqua; position: absolute; width: 24px;
height: 24px; right: 0px; bottom: 0px">
</div>
<div id="topFill" style="background-color: Lime; position: absolute; top: 0px; left: 24px;
right: 24px; height: 24px;">
</div>
<div id="leftFill" style="background-color: Yellow; position: absolute; width: 24px;
left: 0px; bottom: 24px; top: 24px;">
</div>
<div id="bottomFill" style="background-color: Lime; position: absolute; height: 24px;
bottom: 0px; left: 24px; right: 24px;">
</div>
<div id="rightFill" style="background-color: Yellow; position: absolute; width: 24px;
top: 24px; right: 0px; bottom: 24px;">
</div>
<div id="middleFill" style="background-color: Fuchsia; position: absolute; left: 24px;
right: 24px; top: 24px; bottom: 24px;">
</div>
<div id="contentContainer" style="top: 0px; left: 0px; white-space: nowrap; position: absolute;">
ALongStringOFTEXTThatDoesNotBreakToForceTestIfTheDivWillProperlyExpand
</div>
</div>
感谢任何能让我摆脱困境的人!顺便说一句,这篇文章是经过数小时的研究和理智的丧失。 ;-)
【问题讨论】:
标签: html