admin管理员组文章数量:1391943
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
3 Answers
Reset to default 3display: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;
本文标签: javascriptHow to add bottom padding in spanStack Overflow
版权声明:本文标题:javascript - How to add bottom padding in span - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744690913a2619988.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论