How do I make a tabbed view in HTML?

后端 未结 9 1709
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-13 05:20

When clicking on tab A, show content for tab A. Click on tab B, show content for tab B, and so on.

What\'s the most simple and compatible way of constructing a HTML snip

相关标签:
9条回答
  • 2021-02-13 05:40

    If "simple and compatible" are your only two criteria, I'd suggest the jQuery UI Tabs plugin. Cross-browser, and a cinch to implement.

    0 讨论(0)
  • 2021-02-13 05:52

    If you're open to using JavaScript, jQuery's tab is pretty nice.

    0 讨论(0)
  • 2021-02-13 05:53

    TabTastic is a good guide — it is accessible, and (when JavaScript is not available) fails very gracefully.

    0 讨论(0)
  • 2021-02-13 05:55

    Take a look at an example such as this (courtesy of a Google search for 'tabbed view javascript').

    You can obviously use this with a little customisation, but it's instructive to take it apart and determine what it's doing. It's basically enabling or disabling <div> using the display style and setting it to block or none

    0 讨论(0)
  • 2021-02-13 05:57

    The tabs widget in jQuery UI is easy to use: http://jqueryui.com/demos/tabs/.

    The jQuery tabs widget works completely on the browser side - content for all tabs are sent on every request, or you could write JavaScript code that uses Ajax to load the tab contents dynamically.

    But it might not be appropriate for your use. Consider if you need to control the tabs server-side (that is, a click on a tab sends a new page request to the server - the server constructs HTML that has the visual appearance of tabs).

    0 讨论(0)
  • 2021-02-13 05:58

    Here is a list of different types of tabs plus tutorials on how to build them

    0 讨论(0)
提交回复
热议问题