简体   繁体   English

使用jQuery按钮将带有省略号的文本水平对齐

[英]Horizontally Align Text w/ Ellipsis with jQuery button

I am trying to horizontally align some text (w/ ellipsis) with a jquery button and can't figure out whats going on. 我正在尝试使用jquery按钮将某些文本(带省略号)水平对齐,但无法弄清楚发生了什么。

Here is a jsfiddle displaying my problem: 这是显示我的问题的jsfiddle:

http://jsfiddle.net/5bVDu/ http://jsfiddle.net/5bVDu/

<span>
    <span id='heading'>Long Heading That Requires Ellipsis</span>
    <span id='hiddenID'>ID</span>
    <button id='closeTab'></button>
</span>

As you can see, the button appears to be a little offset (lower) from the text, how can I get them to appear horizontally aligned? 如您所见,该按钮似乎与文本有点偏移(较低),如何使它们显示为水平对齐?

I've tried messing with padding, margin, vertical-align with no success, would really appreciate some help from any of you css gurus out there! 我已经尝试过弄乱padding,margin,vertical-align并没有成功,真的很感谢你们其中任何CSS专家提供的帮助! thanks! 谢谢!

Add vertical-align:top to #closeTab : vertical-align:top添加到#closeTab

#closeTab {
    height: 16px;
    width: 16px;
    margin-left:5px;
    vertical-align:top;
}

jsFiddle example jsFiddle示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM