How can I make a fieldset legend-style quot;background linequot; on heading text?(如何制作字段集图例风格的“背景线?在标题文本上?)
问题描述
我正在尝试将标题文本设置为类似于您的 默认图例文本 出现在字段集中;也就是说,我想要一条类似删除线的线来达到但不是通过文本.我似乎找不到任何关于如何完成此任务的信息,而且由于在许多其他问题上,Google 总是将我引导到 Stack Overflow 寻求答案,我想这里有人可以给我建议.
I'm attempting to style heading text similar to how your default legend text appears in fieldsets; that is to say, I'd like a strikethrough-like line to come up to, but not through, the text. I can't seem to find any information on how I might accomplish this, and since on numerous other questions Google's always directed me to Stack Overflow for answers, I thought someone here may be able to give me advice.
为了更清楚.我正在尝试对标题文本产生这种影响:
For greater clarity. I'm attempting to get this effect on header text:
<罢工> 居中的标题文本
有什么办法吗?
推荐答案
参见: http://jsfiddle.net/thirtydot/jm4VQ/
如果文本需要换行,这将不起作用.在 IE7 中,不会出现一行.
If the text needs to wrap, this won't work. In IE7, there will be no line.
HTML:
<h2><span>Centered Header Text</span></h2>
CSS:
h2 {
text-align: center;
display: table;
width: 100%;
}
h2 > span, h2:before, h2:after {
display: table-cell;
}
h2:before, h2:after {
background: url(http://dummyimage.com/2x1/f0f/fff&text=+) repeat-x center;
width: 50%;
content: ' ';
}
h2 > span {
white-space: nowrap;
padding: 0 9px;
}
这篇关于如何制作字段集图例风格的“背景线"?在标题文本上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何制作字段集图例风格的“背景线"?在标题


- 为什么我的页面无法在 Github 上加载? 2022-01-01
- 为什么悬停在委托事件处理程序中不起作用? 2022-01-01
- 是否可以将标志传递给 Gulp 以使其以不同的方式 2022-01-01
- 在不使用循环的情况下查找数字数组中的一项 2022-01-01
- 我不能使用 json 使用 react 向我的 web api 发出 Post 请求 2022-01-01
- 如何向 ipc 渲染器发送添加回调 2022-01-01
- 使用 iframe URL 的 jQuery UI 对话框 2022-01-01
- 从原点悬停时触发 translateY() 2022-01-01
- 如何显示带有换行符的文本标签? 2022-01-01
- 如何调试 CSS/Javascript 悬停问题 2022-01-01