user3185936
user3185936

Reputation: 1667

Span with a href link not working

Working to put a href in a span class, but I cant get the href link to work.

<a href="../../public/bassengweb/logout">Logg ut<span class="label label-danger"></span></a>

Also the label-danger wont show up.

Upvotes: 6

Views: 119360

Answers (4)

Hugo
Hugo

Reputation: 69

This is the best way! It works easy and clean.

<span onclick="window.location.href='www.google.com';">text</span>

and then you can give it a class:hover for the color

Upvotes: 6

Aleksandra Kuna
Aleksandra Kuna

Reputation: 35

For label css use:

class="label label-important"

it worked for me

Upvotes: 0

jeugen
jeugen

Reputation: 342

The <span> with class label should have content, check the Boostrap's example Boostrap Component - Label Maybe you should try to put an "x"

<a href="../../public/bassengweb/logout">Logg ut<span class="label label-danger">x</span></a>

or use glyphicons, maybe

<a href="../../public/bassengweb/logout">Logg ut<span class="label label-danger"><span class="glyphicon glyphicon-circle-arrow-right"></span></span></a>

Upvotes: 1

Albzi
Albzi

Reputation: 15609

Link to working span - Bootply

That's because of this line in the CSS:

.label:empty{
  display:none;
}

If you write something between the span tags, it will work.

<a href="../../public/bassengweb/logout"><span class="label label-danger">Logg ut</span></a>

Although, it will look terrible with 'normal' bootstrap label when hovered, maybe do something like this:

<a href="../../public/bassengweb/logout">Logg ut</a><span class="label label-danger">Danger</span>

Upvotes: 7

Related Questions