I am trying to make a dismissable notification dropdown with Twitter Bootstrap 3 and Font Awesome 4. I cannot get the links to align in one line and I have tried:
- enclosing them in a div
- the first link to have an
<i>
element inside it - applying
display:inline
to the links
<ul class="dropdown-menu">
<li>
<a href="/demo" class="pull-left">your friend arrived </a> <a href="" class="pull-right fa fa-remove" on-click="deleteNotification()"></a>
<a href="/demo" class="pull-left">small notification </a> <a href="" class="pull-right fa fa-remove" on-click="deleteNotification()"></a>
<a href="/demo" class="pull-left">your friend arrived big notification</a> <a href="" class="pull-right fa fa-remove" on-click="deleteNotification()"></a>
</li>
</ul>
you can see a full example here http://www.bootply.com/66SAUtHtnv
posted image is after applying also this css snippet:
.dropdown-menu>li>a {clear: none;}[![enter image description here][1]][1]
2
Answers
Give
class="pull-left"
for the<a>
tags.It must be like
pull-left
andpull-right
. And give this CSS:Coz by default, bootstrap is clearing the
<a>
tags inside the dropdown.You can do this with CSS as I doubt any built in Bootstrap classes will be able to achieve this. Here are two example depending on how you ultimately want this to look.
Both of these examples use an added class do the default isn’t altered and so the default dropdown can still be used across your application and all the add CSS can be found at the end under this comment: /* Added CSS for Notifications. */
Example 1: This is the refined version as it creates space for the remove icon and always places it furthest to the right so all the icons are vertically aligned no matter how long the link text is.
Example 2: This simply changes the display property so both a tags are on the same line.