How would you style a legend map with css only (no images)?
Do I use div element for little squares of color or a span element?
Something like this: http://golondrinas.cornell.edu/Maps/Map%20legend.png
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use whatever you want. There’s no best practice for this rather rare example.
The description “a coloured box” fits a
divbest I think.spanwould usually mean something inline, but could work as well, seeing as there is one per line, so to speak. You would have to make itinline-block, which isn’t supported in all browsers, orblock, but adivis block by default, so no hassle with that. With adivhowever you would need to possiblyfloatit, i’m not quite sure. With both you’d have to set thewidth.So to summarize, there’s none that is better than the other, but
divwould be more semantically correct, sincespanshould usually contain something that it “spans”.