Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

How to specify authors name in HTML5?

Hello guys,

I am wondering, that becuase cite element is not used for author names in HTML5 anymore, is there any different way we can specify it?

For example:

<p> My favourite book is <cite>Harry Potter and the Philosopher's Stone</cite> by J.K.Rowling </p>

Which tag shoould be J.K.Rowling be nested in? If any.

I know, that for whole article or block you can use <address> element, but you can't do that in this case.

btw. Sorry for my english, I am not from english speking country. Frank

7 Answers

Sorry for duplicate reply!

No problem, I've found this discussion, but it doesn't make sense to me, to use <span class="author"> And when I don't want to use any for that 3 elements, that provide rel="author" atributte.

I thought, that, because the answer is 3 years old, there is some new info concerning this issue.

Anyway, thanks for help.

Frantisek,

The latest HTML5 specification release candidate does recommend using <cite> for author names: "The cite element represents a reference to a creative work. It must include the title of the work or the name of the author(person, people or organization) or an URL reference, which may be in an abbreviated form as per the conventions used for the addition of citation metadata."

The discussion linked talks about that (even thought its from 2011), and the spec (on this issue anyway) hasn't changed significantly.

W3C does recommend it, but according to WHATWG spec, you shouldn't use <cite> element for author name (see link )

And if I have right info, both of these organisations are developing HTML and its standards.

Yes, it's confusing.

According to WHATWG's FAQ:

```From what some have seen, <cite> is almost always used to mean "italics". More careful authors have used the element to mark up names and titles, and some people have gone out of their way to only mark up citations.

So, we can't really decide what the element should be based on past practice, like we usually do.

This leaves the question of what is the most useful use we can put the element to, if we keep it. The conclusion so far has been that the most useful use for <cite> is as an element to allow typographic control over titles, since those are often made italics, and that semantic is roughly close to what it meant in previous versions, and happens to match at least one of the common uses for the element. Generally, however, names and titles aren't typeset the same way, so making the element apply to both would lead to confusing typography.

There are already many ways of marking up names already (e.g. the hCard microformat, the microdata vCard vocabulary, <span> and class names, etc), if you really need it.```

Again, the original Stackoverflow article linked to discusses all this, with some settling on W3C's <cite> while others preferring the WHATWG hcard/vcard solutions. Barring a more definitive answer, it would seem to be up to the author (you) to decide which spec/solution is more comfortable for you to use.

Sean T. Unwin
Sean T. Unwin
28,690 Points

In this case it would be appropriate to use the rel="author" attribute in an <a> tag.

Ex.

<a href="www.jkrowling.com" rel="author">J.K. Rowling</a>

Resources