开发者

Why is this span above the text? I want it beside the text

开发者 https://www.devze.com 2022-12-25 22:31 出处:网络
<td valign=\"center\" colspan=\"2\"> <a href=\"\" class=\"table_desc\" > <span class=\"desc_info_butt\"></span>
<td valign="center" colspan="2">
        <a href="" class="table_desc" >
        <span class="desc_info_butt"></span>
        </a>
        text here
</td>


.desc_info_butt{
background:url(Description_Button.png) top left no-repeat;
height:16px;
width:16px;
display:block;
}

For some reason, the image and text appear on two diff开发者_运维知识库erent lines!~


You need to change this:

display:block;

To this:

display:inline-block;

block behaves like any block element, pushing the next one below it. You either need to make it an inline-block, float it, or take away the block styling all-together.


Try giving the span a float: left

at the moment, it's a block level element, forcing everything else into the next line.

By the way, I'd recommend putting a &nbsp; into the span so it gets displayed in all browsers.


Because you've set your span to display as a block-level element. Remove the display: block and that should fix it.


display:block transforms the span in a block (equivalent to div) so that moves the next elements on a new line

0

精彩评论

暂无评论...
验证码 换一张
取 消