【发布时间】:2012-08-22 18:23:27
【问题描述】:
【问题讨论】:
-
不,只需要与文本周围完全相同的背景颜色 + 边框:“示例”。所以想要在
well的左上角。感谢您的帮助
标签: html css layout twitter-bootstrap responsive-design
【问题讨论】:
well 的左上角。感谢您的帮助
标签: html css layout twitter-bootstrap responsive-design
而不是将:before 应用于外部div。我做到了.well并将填充顶部和左侧调整为-20px..
即
.well:before {
position: relative;
content: "Example";
top: -20px;
left: -20px;
padding: 3px 7px;
font-size: 12px;
font-weight: bold;
background-color: #f5f5f5;
border: 1px solid #ddd;
color: #9da0a4;
-webkit-border-radius: 4px 0 4px 0;
-moz-border-radius: 4px 0 4px 0;
border-radius: 4px 0 4px 0;
}
【讨论】:
您只需检查文档中的代码,就会发现这个 css 应用于示例包装器:
.bs-docs-example::after {
content: "Example";
position: absolute;
top: -1px;
left: -1px;
padding: 3px 7px;
font-size: 12px;
font-weight: bold;
background-color: whiteSmoke;
border: 1px solid #DDD;
color: #9DA0A4;
-webkit-border-radius: 4px 0 4px 0;
-moz-border-radius: 4px 0 4px 0;
border-radius: 4px 0 4px 0;
}
在你的 CSS 中添加一些类似于自定义类的东西,或者你甚至可以用更少的代码来使用引导变量和 mixins。如果您希望文本可添加,最好忘记 :after 并稍微调整此样式以将其应用于包含所需文本的特定元素并将其放置在包装器中。
编辑:
为了使定位起作用,您还应该将包装器设置为position: relative;。不知道你在追求什么,但我更新了你的小提琴来展示:http://jsfiddle.net/YdusM/9/
【讨论】:
content: offcourse) .像这样:jsfiddle.net/YdusM/15