Href on any element

The href attribute transforms an anchor (A element) into a hyperlink. With Sircl, the href can be used on any element. In this example, we'll make hyperlinks of table rows.

In this example, each table body row is clickable as a href attribute on the table row element has turned the rows into hyperlinks:

<table class="table table-hover">
    <tr href="/Profile/LizaDonnovan">
      <td>Liza Donnovan</td>
    <tr href="/Profile/PeterJohnson">
      <td>Peter Johnson</td>

(The table has been styled with Bootstrap classes.)

You can apply styling to elements having a href attribute as follows:

  [href] {
    cursor: pointer;

The ability to transform any element into a hyperlink is practical, but you should be aware that search engines may ignore href attributes if they do not appear on anchor (A) elements.

The href attribute behaves identical to the onclick-load attribute. Prefer the onclick-load attribute when the behaviour of a hyperlink is desired, without the look or styling of a hyperlink.


Working demo
Loading demo...



This example requires following Sircl library files to be loaded:


Or their non-minified counterparts.

See the Get Started section about how to set up your project to use the Sircl library.