How would you markup a building plan/map using semantic HTML?

谁说我不能喝 提交于 2019-12-10 11:52:25

问题


The building (a museum) has 7 levels (+3 to -3), each divided into different rooms/areas. Hovering over an area will reveal a popup describing that area.

I'm looking for some markup that will accurately represent the 7 levels and their areas. The plan should make sense and be 'navigable' without any CSS/JS.

Edit: Some clarification, the markup only has to represent the 'semantic structure' of the building, not the spatial layout (CSS will add in the layout and graphics).


回答1:


Smells like a nested, unordered list to me.




回答2:


Sounds like a job for SVG? (Sample Adobe Building in San Jose)

I realize that this does use JavaScript, but if you have 7 floors * 10+ rooms? this would get rather hairy with pure CSS. You could use some <ul> elements to make nested levels of rooms, but if the building is this big, I don't think the list (even if rendered as blocks) would be meaningful to view.




回答3:


Take a look at microformats, specifically the XOXO Microformat.




回答4:


Using HTML5 (but shouldn't make a big difference if you'd like to use HTML 4.01):

If you want to represent the building with images, you can use an Image Map, consisting of map and area. The area (href attribute) could link to a page containing the detailed description of the room. The alt attribute could contain a short description of the room, like "Strawberry room (level 4)".

If the markup is more like a text-alternative (for example, if you'd use object, canvas or something like that), I would go with a heading structure:

<section>
 <h1>The building</h1>

 <section id="level-1">
  <h1>Level 1</h1>

   <section id="level-1-room-1">
    <h1>Room 1</h1>
    <p>description of room 1</p>
   </section>

   <section id="level-1-room-2">
    <h1>Room 2</h1>
    <p>description of room 2</p>
   </section>

 </section> <!-- #level-1 -->

 <section id="level-2">
  <h1>Level 2</h1>

   <section id="level-2-room-1">
    <h1>Room 1</h1>
    <p>description of room 1</p>
   </section>

   <section id="level-2-room-2">
    <h1>Room 2</h1>
    <p>description of room 2</p>
   </section>

 </section> <!-- #level-2 -->

</section>

(for HTML 4.01, you would use div instead of section and adjust the heading level accordingly)



来源:https://stackoverflow.com/questions/388843/how-would-you-markup-a-building-plan-map-using-semantic-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!