10

I am trying to write semantic HTML for a business card. I want to show the name, title, email and phone number on the markup.

<div id="bussinesscardcontainer">
         <section class="Details">
               <span> Name :ABC</span>
               <span> Title:XYZ </span>
           </section>
      <footer class="contact">
            <span class="email"> Email:abc@abc.com</span>
            <span class="phonenumber">Mobile:123-123-123</span>
        </footer>
 </div>

I just want to understand is my markup sematically right or not.

This markup would end up looking as Difficulty in Designing Business card using CSS

Community
  • 1
  • 1
Geeky
  • 7,420
  • 2
  • 24
  • 50

3 Answers3

6

Your use of the section and footer element is not correct. These two lines shouldn’t form a section, and the footer would belong to the parent section (which might be the whole document), instead of the business card only.
If you need a sectioning content element (it depends on the context), it should wrap the whole business card. It seems that you don’t need a footer (or header) at all here.

For the actual content, you could use a dl element, as your card consists of name-value pairs.

The email address and the telephone number could become hyperlinks, with the a element.

So that gives you:

<dl class="business-card">
  <dt>Name</dt>
  <dd>ABC</dd>

  <dt>Title</dt>
  <dd>XYZ</dd>

  <dt>Email</dt>
  <dd><a href="mailto:abc@abc.com">abc@abc.com</a></dd>

  <dt>Mobile</dt>
  <dd><a href="tel:123123123">123-123-123</a></dd>
</dl>
Graham
  • 7,431
  • 18
  • 59
  • 84
unor
  • 92,415
  • 26
  • 211
  • 360
4

Your markup is technically correct but could subjectively be improved.

The HTML5 spec added many, more descriptive HTML properties like <footer> that you are using but left implementation up to web developers. This has resulted in less than optimal usage of HTML properties in my experience.

For structural components of a document, the best guide I've found is produced by HTML5Doctor, which gives you a flow chart of usage guidelines for these properties.

In your specific case, I'd probably omit the use of <footer> and switch how you are using <section> and <div> like this:

<section class="businesscard-container">
  <div class="businesscard-details">
    <span> Name :ABC</span>
    <span> Title:XYZ </span>
  </div>
  <div class="businesscard-contact">
    <span class="email"> Email:abc@abc.com</span>
    <span class="phonenumber">Mobile:123-123-123</span>
  </div>
</section>
serraosays
  • 7,163
  • 3
  • 35
  • 60
2

HTML not have semantic for this purpose. You have tu use microformat (http://microformats.org/). This standard is created for business card, address, recipes and many more.

Is used by search engine, browser and other.

h-card is the html microformat standard you need (http://microformats.org/wiki/h-card). An example:

<p class="h-card">
  <img class="u-photo" src="http://example.org/photo.png" alt="" />
  <a class="p-name u-url" href="http://example.org">Joe Bloggs</a>
  <a class="u-email" href="mailto:joebloggs@example.com">joebloggs@example.com</a>, 
  <span class="p-street-address">17 Austerstræti</span>
  <span class="p-locality">Reykjavík</span>
  <span class="p-country-name">Iceland</span>
</p>
Germano Plebani
  • 3,461
  • 3
  • 26
  • 38