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

Why is actually "<span>" and "<cite>" tags used for?

Dont know why these two are used in html...please someone give me something to learn...and sorry for my bad english.

Sir,you really are a good teacher.Thank You , Now i understand more....

1 Answer

Okay, so the span element is generally used for styling purposes and has no real semantic meaning. For an example, you might want to style a single word within a heading element.

<h1>Hello, <span>World</span>!</h1>
h1 span {
  color: blue;
}

The cite element is for semantically (describing) a title for pieces of work such as a tv show, film, video game, or essay. For an example, you might want a markup a title of a book with the cite element.

<p><cite>HTML5 Foundations<cite> by Matt West.</p>

sir, couldn't really understand what cite element does...?

Um, let's say you're writing review for a video game. The title of this video game is, StarCraft II. Your review starts off something like, "This is my review of StarCraft II." Well, you would want to mark up the title, StarCraft II within the cite element. Why? Because the cite element describes the title of a piece of work A.K.A StarCraft II.

<p>
    This is my review of <cite>StarCraft II</cite>.
</p>

Maybe you're writing about a movie you've recently seen.

<p>
    I recently watched <cite>Star Wars: Episode VII : The Force Awakens</cite>... It was so awesome!!!! #memories
</p>

or maybe a TV show.

<p>
    Just started watching <cite>Psych</cite>. 11/10 will be binging on Netflix.
</p>

Hope this help =D.