Okay first of all I'm not sure if this is the right place to ask this question, even though it's about the site itself it's about programming, too. But here it goes:

When I am doing web development I often check implementations of other popular sites as references, SO being the top in my list. My question is, why does SO implement the question list as generic divs instead of list items? My intuition will be to use <ul> and <li>. Is there any reason behind that I can learn from?

EDIT: before the discussion shifts to general discussion about HTML elements, the answer I am able to distill between comments and answers is that "The use of <div>'s in the question list doesn't imply anything but just an implementation decision, people are aware that it isn't the most semantic way but it doesn't matter that much either. Feel free to take whatever approaches you find are better". However, at the time that this edit is made no one is able to put together answers like that so no answer is accepted as of yet.

  • 10
    Next question: Why do they also use tables for questions? – Josh Crozier Nov 25 '13 at 18:28
  • 3
    Maybe because tables are much easier to control? Despite the pedantry that revolves around the horror of not using correct semantic markup, many websites commonly do this without ripping a hole in the universe. – user102937 Nov 25 '13 at 18:30
  • Next question: Why does meta-SO the background-color white? OMG dad question :D – tim Nov 25 '13 at 18:58
  • 4
    @RobertHarvey while I agree that the table issue tends to be a 6 vs. half dozen argument, tables aren't necessarily easier to control when used for layout. They tend to solve some problems while creating a host of others. – apaul Nov 25 '13 at 19:53
  • Tables! Tables everywhere! – PeeHaa Nov 25 '13 at 22:02

<div> does not have any particular meaning or default CSS styling, but <ul> does. When you use <ul> but you do not want the bullets to be there on the list elements, you have to add your own CSS to remove that styling.

Therefore, it is just simpler to start with <div> and add styling to it, rather than start with something where you have to take styling away.

Is it better to use <ul> and have the "semantics" of a list, even though it gets styled as a bunch of boxes? That's a broader question. I am not sure which is better. It looks the same in the end, so this decision is probably a matter of taste/opinion.

Ultimately, the question must be answered by the programmer who made this decision, so my answer is just a guess.

  • 2
    Who doesn't use a reset.css these days? – Stijn Nov 25 '13 at 18:54
  • 1
    That could be a reason, but I can't justify using <div> over list because of that. I believe that markup should have nothing to do with visual effect, that's what CSS is for. Instead HTML markup should strike every effort to imply maximum semantic meaning of the content. – Xavier_Ex Nov 25 '13 at 18:57
  • @Xavier_Ex: you don't have to justify it, it's not your code. And the SE developers don't have to justify it either. I suppose if you don't like it you could go off to Yahoo answers. – Wooble Nov 25 '13 at 18:59
  • 8
    There's a pretty good chance Yahoo Answers' markup isn't semantically correct either. – user102937 Nov 25 '13 at 19:00
  • @Wooble I ask this question because I sometimes use SO as a good reference when I do my markup, considering this is such an active community with many talented/authoritative web developers. I humble the fact that I am not one of them so I want to find out if such implementation implies any knowledge I don't know about. I'm not here to judge anyone, if the answer is "they decided to do it for the advantage and nothing seems to be broken" I am happy with that. At least I learn that. – Xavier_Ex Nov 25 '13 at 19:05
  • 2
    The people who come here looking for advice on semantic markup don't get it by selecting View/Source in their browser, @Xavier. The web sites are run by their respective communities for the most part, but we don't get to decide what sort of markup the SE employees use. – user102937 Nov 25 '13 at 19:06
  • @RobertHarvey I assume your comment meant no sarcasm. I just expect that the site itself has a good level of reference value and I find that true from time to time, just like how you expect the NY Stock Exchange to be a good example of how to do investment market since most major investors use it. Again I'm not here to judge anyone, but if you tell me I shouldn't expect that much from the markup of the site as reference, that's a good and valid answer to my question, too. – Xavier_Ex Nov 25 '13 at 19:14
  • I was dead serious. When you View/Source a Stack Exchange site, you're viewing the coding habits of a very small but core (and dare I say extremely intelligent) group of people, not the user community. Most of the Stack Exchange sites don't even have anything to do with programming, but they use the same software that Stack Overflow does. – user102937 Nov 25 '13 at 19:16
  • 1
    @Xavier_Ex: the site's also coded using .Net, yet it's an excellent source of information about Python. By comparison, do you consider NYX to be the best stock to buy? – Wooble Nov 25 '13 at 19:16
  • 1
    @Wooble I won't consider NYX to be the best stock to buy, I think that implies buying NYX stock would be the most profitable and it's not the same case we discuss here. But I get what you mean so no need to derive further analogy. I feel like the discussion is derailing towards some other topic. So I take the advice you guys (and RobertHarvey too) provided as saying "No there isn't any implied knowledge behind using <div> as the question list, it's just an implementation decision and feel free to take approaches you think are better". – Xavier_Ex Nov 25 '13 at 19:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .