Which one of these web components is designed better?

Option 1 contains an a tag within the custom element.

  <bootstrap-social service="github" size="lg">
    <a href="http://github.com/reggi">Sign in with Github</a>

Option 2 the custom element has an href tag and the inner text is within the element.

  <bootstrap-social service="github" size="lg" href="http://github.com/reggi">
    Sign in with Github
  • 3
    \$\begingroup\$ I suspect the first would be preferable for graceful degradation... \$\endgroup\$
    – Schism
    Aug 8, 2014 at 2:05

1 Answer 1


Since the only difference between the two examples is the href attribute we see in DevDocs that:

Elements in HTML have attributes; these are additional values that configure the elements or adjust their behavior in various ways to meet the criteria the users want.

In the documentation, the only elements that receive the href attribute are: <a>, <area>, <base> and <link>. Although href works with any other element, I believe that, when it comes to semantics, Option 1 is the most suitable.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.