【发布时间】:2012-07-22 15:20:41
【问题描述】:
我在 div 中有一个带有文本的跨度。在那个跨度的前面,我想要一条 2 px 的线到左边的边缘。在文本之后,我想要一条模拟线转到父元素的右边缘。
当前标记:
<div style="width: 400px;">
<span class="label" style="padding-left: 40px;">This is my text</span>
</div>
预期结果:
----- This is my text --------------------------
什么是我的问题的最佳解决方案?
我尝试在文本后面的行中使用额外的跨度。没能把它弄好。它基于Let span fill remaining width?。我的尝试可以在here找到。
更新:
父 div 有一个渐变颜色作为背景和一个高度。 AFAIK 无法使用文本上的背景颜色。
<div style="
background-image: none;
background-color: #99D166;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #C0E3A1), color-stop(3%, #A6D77A), color-stop(100%, #8CCB52));
background-image: -webkit-linear-gradient(top, #C0E3A1, #A6D77A 3%, #8CCB52);
background-image: linear-gradient(top, #C0E3A1, #A6D77A 3%, #8CCB52);
width: 400px;
height: 40px;">
【问题讨论】:
-
玩这个你会得到答案jsfiddle.net/surendraVsingh/yDLuK/7
标签: css