0

Playing with Bootstrap. See the code at this page:

http://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_glyphs&stacked=h

It displays a Print button with a glyphicon before text "Print":

<p>Print icon on a styled link button:
  <a href="#" class="btn btn-success btn-lg">
    <span class="glyphicon glyphicon-print"></span> Print 
  </a>
</p> 

This renders nicely with text "Print" using font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif'

However, this code should be semantically the same (XHTML / close span tag in element itself):

<p>Print icon on a styled link button:
  <a href="#" class="btn btn-success btn-lg">
    <span class="glyphicon glyphicon-print" /> Print 
  </a>
</p> 

But it renders the text in a different font-family 'Glyphicons Halflings'. You can try making the change in the w3schools.com editor to see the effect.

Looking at Chrome inspector, apparently the Print text was included as part of the span and inherited the font-family from the glyphicon.

So, why can't the span be closed using the XHTML syntax <span ... />? Is there a particular reason for it, or something else I'm missing?

Mohamed Bdr
  • 967
  • 3
  • 9
  • 20
Jose Cifuentes
  • 596
  • 6
  • 21
  • 1
    possible duplicate of: http://stackoverflow.com/questions/2816833/can-a-span-be-closed-using-span - if your Markup and Doctype is correct, this should work. – dstN Feb 25 '16 at 15:12
  • I agree is related to that question. I did browse around the net and experimented with different doctypes, and was not able to make it work with a single span tag. Not sure what I'm doing wrong or what exact doctype is needed. – Jose Cifuentes Feb 25 '16 at 18:51

0 Answers0