views:

392

answers:

6

Is there any benefit in using a blockquote over a div? I was looking at a website's mark up to learn css and I couldn't figure out why the blockquote was being used.

EDIT: Yeah sorry I didn't clarify, it was used to hold the div tag with username as text and an input tag. There was clearly no quote.

+9  A: 

Semantically, a blockquote tag makes sense when you're quoting something. Sure, a stylized div can do the same thing, but why not use the right tag for the job?

Additionally, the blockquote tag allows you to include a citation with the cite attribute.

pix0r
+2  A: 

<blockquote> should be used when the text it contains is a block quote. This sounds very obvious to me, so is there another aspect to your question?

John Millikin
A: 

As mentioned, <blockquote> is for quoting. Similarly you will use several <p> blocks for paragraphs within one <div> that holds page content or whatever. HTML5 proposal will have lot more block elements (i.e same as divs) which purpose will be to add a semantic info about it, such as header, footer, menu, etc.

Slartibartfast
A: 

As mentioned earlier, blockquotes are for quotes. Just like tables are (arguably) for tabular data, lists are for listings, divs for divisions, p for paragraphs, etc.

Sure, you could almost everything with divs. That's the beauty of using HTML with CSS: you can make anything look however you want it to look (in theory, in the real world browser quirks mess that up sometimes).

Using divs for anything you can think of is commonly known as 'divitis'. See this article for a little explanation :)

Erik van Brakel
+6  A: 

In theory, HTML should be as "semantic" as possible - meaning that every element should indicate something about its content. <h1>s should enclose the most important headline; <p>s should surround paragraphs; <em> should indicate emphasis, etc.

That way the code makes sense when you - or a screen reader, or whatever - look at it. This also helps for devices that don't understand all (or any) of your CSS rules.

Nathan Long
A: 

The likely reason they're using blockquote is that many people dabbling in HTML don't know enough about CSS to know that a div can be given the same left-margin as blockquote renders with by default.

ceejayoz