javascript - How to add bottom padding in span - Stack Overflow

Got a link that got a span, inside that span I will from jquery add a number of news. But I want it to

Got a link that got a span, inside that span I will from jquery add a number of news. But I want it to be smaller and with a bit of padding so it looks like a notification on a app?

This is the code I got:

<a id="menyNavOptions" href="nyheter.php" >Nyheter<span style="margin-bottom: 30px; font-size: 0.8em;font-weight:bolder ; color: #ff0000!important; line-height:0.3em;" id="outPost"></span></a>

So the look I am going for is a Link with a number on the top right corner

Thanks

Got a link that got a span, inside that span I will from jquery add a number of news. But I want it to be smaller and with a bit of padding so it looks like a notification on a app?

This is the code I got:

<a id="menyNavOptions" href="nyheter.php" >Nyheter<span style="margin-bottom: 30px; font-size: 0.8em;font-weight:bolder ; color: #ff0000!important; line-height:0.3em;" id="outPost"></span></a>

So the look I am going for is a Link with a number on the top right corner

Thanks

Share Improve this question asked Dec 2, 2013 at 18:32 Christoffer JacobsenChristoffer Jacobsen 1,2513 gold badges14 silver badges14 bronze badges 1
  • can you explain more it looks like a notification on a app with an image or something else – DaniP Commented Dec 2, 2013 at 18:41
Add a ment  | 

3 Answers 3

Reset to default 3

display:block won't help, because it will have the full width (100%). Use display:inline-block;

http://jsfiddle/M5TKv/

But I'm not sure if Padding bottom will do what you want.

I think you want to do this:
http://jsfiddle/M5TKv/1/

Try add display:inline-block in the CSS and it should behave as you expect :)

But I would rather use position relative on the link and position absolute on the span.

.linkclass {
    position: relative;
}
.spanclass {
    position: absolute;
    top: -10px;
    right: 0;
}

Add display: inline-block; float: right;

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744690913a4588203.html

相关推荐

  • javascript - How to add bottom padding in span - Stack Overflow

    Got a link that got a span, inside that span I will from jquery add a number of news. But I want it to

    23小时前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信