[英]how to remove break lines between a span tag in HTML
it appears that my <span>
tags causes a new line break inside my <td>
. 看来我的<span>
标记在<td>
内引起了新的换行符。 how do you normally fix this? 您通常如何解决此问题?
<tr>
<td> date</td> <!--date-->
<td> <span class="icon1"> <img here> </span> | <span class="icon2"> <img here> </span> </td> <!--action-->
</tr>
[update = added css] [更新=添加CSS]
.icon1{
width:22px;
height:22px;
background-color:#eb2960;
display:block;
border-radius:4px;
cursor: pointer; cursor: hand;
}
Use display: inline-block
for the .icon
. 对.icon
使用display: inline-block
。
display: block
causes a line break before and after the element. display: block
导致元素前后的换行。
Change: 更改:
.icon 1{
...
display:block;
...
}
to: 至:
.icon 1{
...
display:inline-block;
...
}
You had to know that display in block separates things with a line break... :P 您必须知道块显示以换行符分隔....:P
As you can see in this jsfiddle the span doesn't affect to any element of the td. 如您所见,在jsfiddle中 ,跨度不影响td的任何元素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.