Html 带边框的 CSS 跨度
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22230474/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
CSS span with border
提问by theLaw
Hi i don't get why my span with border looks like this
嗨,我不明白为什么我的带边框的跨度看起来像这样
this is the css behind
这是后面的css
color:red;
font-size: 12px;
background-color: #ffcaca;
background-image:url(/Content/x.png);
background-size: 20px 20px;
background-repeat:no-repeat;
background-position:2px;
padding: 5px;
border-radius: 5px 5px 5px;
border: 1px solid red;
padding-left: 25px;
position:relative;
and html
和 html
<tr>
<td>
<span>[...]</span>
<td>
<tr>
回答by Mr_Green
You can give display: block
to the span element or use div
element instead of using span
element.
您可以给display: block
span 元素或使用div
元素而不是使用span
元素。
I would prefer the latter one.
我更喜欢后者。
回答by JeanCharles Amey
if you are stuck in a wordpress theme because you don't want to touch to the template and you just want to add custom css, using display: block
or display: inline-block
will be perfect.
如果您因为不想接触模板而被困在 wordpress 主题中,而只想添加自定义 css,那么使用display: block
或display: inline-block
将是完美的。