Here http://jsfiddle.net/C7rSa/是一把小提琴。
<p>foo <a class="infolink" href="#">bar</a> baz</p>
and
a.infolink::before
{
content: '?';
background: blue;
color: white;
width: 20ex;
height: 20ex;
}
这 '?'出现但显然没有 20ex 大小。为什么不?在 Firefox 和 Chrome 中测试。
注:::before
and ::after
伪元素 https://www.w3.org/TR/css-pseudo-4/#generated-content实际上已铺设display: inline;
默认情况下。
将显示值更改为inline-block
使宽度和高度生效,同时保持内联格式化上下文。
a.infolink::before {
content: '?';
display: inline-block;
background: blue;
color: white;
width: 20px;
height: 20px;
}
http://jsfiddle.net/C7rSa/3/ http://jsfiddle.net/C7rSa/3/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)