I have the following code to add badges:
@foreach (var item in items)
{
<span class="badge badge-secondary badge-larger">@item.Name</span>
}
And the following css:
.badge.badge-larger {
padding-right: 5px;
font-size: 0.9em;
}
The size is being applied. However I can't seem to add padding to the right.
What is the correct way to add padding to badges?
I have the following code to add badges:
@foreach (var item in items)
{
<span class="badge badge-secondary badge-larger">@item.Name</span>
}
And the following css:
.badge.badge-larger {
padding-right: 5px;
font-size: 0.9em;
}
The size is being applied. However I can't seem to add padding to the right.
What is the correct way to add padding to badges?
Share Improve this question asked Mar 12 at 9:34 Ivan DebonoIvan Debono 9211 gold badge6 silver badges20 bronze badges 3 |1 Answer
Reset to default 1@foreach (var item in items)
{
<span class="badge text-bg-secondary badge-larger">@item.Name</span>
}
//default bootstrap padding
.badge{
padding:0.35em 0.65em;
font-size: 0.75em;
}
//as you need customize styles like padding, size etc..
.badge.badge-larger{
padding:0.5em 1em;
font-size: 1em;
}
!important
for yourpadding-right
style? It is used to give a specific property higher priority over other rules that might be affecting the same property. Sopadding-right: 5px !important;
. – Richard Commented Mar 12 at 17:38