Advertisement
ssaidz

CSS TABULATION

Aug 26th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <meta name="viewport" content="width=device-width, initial-scale=1">
  4. <link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
  5. <body>
  6.  
  7. <div class="w3-container">
  8. <h2>Tabs</h2>
  9. <p>Tabs are perfect for single page web applications, or for web pages capable of displaying different subjects. Click on the links below.</p>
  10. </div>
  11.  
  12. <ul class="w3-navbar w3-black">
  13.   <li><a href="#" onclick="openCity('London')">London</a></li>
  14.   <li><a href="#" onclick="openCity('Paris')">Paris</a></li>
  15.   <li><a href="#" onclick="openCity('Tokyo')">Tokyo</a></li>
  16. </ul>
  17.  
  18. <div id="London" class="w3-container city">
  19.   <h2>London</h2>
  20.   <p>London is the capital city of England.</p>
  21. </div>
  22.  
  23. <div id="Paris" class="w3-container city">
  24.   <h2>Paris</h2>
  25.   <p>Paris is the capital of France.</p>
  26. </div>
  27.  
  28. <div id="Tokyo" class="w3-container city">
  29.   <h2>Tokyo</h2>
  30.   <p>Tokyo is the capital of Japan.</p>
  31. </div>
  32.  
  33. <script>
  34. openCity("London")
  35. function openCity(cityName) {
  36.     var i;
  37.     var x = document.getElementsByClassName("city");
  38.     for (i = 0; i < x.length; i++) {
  39.        x[i].style.display = "none";
  40.     }
  41.     document.getElementById(cityName).style.display = "block";
  42. }
  43. </script>
  44.  
  45. </body>
  46. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement