float a number over a font awesome icon

I want to float the number of messages a user has over the top of the comment icon . I am not sure how to accomplish this with CSS.

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

<div class="item-content">
        <div class="item-media">
            <i class="fa fa-envelope-o"></i>
        </div>
        <div class="item-inner">

            <span class="title"> Messages <i id="mailicon" class=" fa fa-comment fa-1x"></i></span>
        </div>
    </div>

Open in new window


The mailicon ID is just used in the javascript to add the  fa fa-comment fa-1x class when there is a new message.  so if there are two messages I want to float a 3 over the comment icon.
austinfxAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tom BeckCommented:
You could add a <sup> inside the <i> tag like:
<span class="title"> Messages <i id="mailicon" class=" fa fa-comment fa-1x"><sup>3</sup></i></span>

Open in new window


Then modify or override line 81 of bootstrap.css.
Modify (changes all <sup> tags):
sup {
    left: -1em;
    top: -1em;
}

Open in new window

Override (specific to just <sup> tags next to comment icons).
.fa-comment sup {
    left: -1em;
    top: -1em;
}

Open in new window

Or whatever position you need. To my eye, just leaving the bootstrap css alone for superscript looks okay too.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
austinfxAuthor Commented:
ok That is close!
The 3 sits above the icon.
Screen-Shot-2015-08-19-at-9.43.20-AM.png
0
Tom BeckCommented:
I want to float the number of messages a user has over the top of the comment icon
Exactly.

You want the number inside the icon you can try this:
sup {
    color: #fff;
    left: -0.9em;
    top: -0.1em;
}

Open in new window

But you should probably change the icon size to "fa-2x" because "fa-1x" is too small to read. If the number goes to double digits, forget about it.
0
austinfxAuthor Commented:
Perfect and Elegant! Thank you!
0
Tom BeckCommented:
You're welcome. Thanks for the points.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.