Jump to content

Bonxy

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Bonxy

  1. Hey, So i'm using w3css to display data on a web page. I've tried to implement the tabs used here - W3.CSS Tabs (w3schools.com). The issue i've had, is if i try to use more than one tab section on a page, when i select a tab, it closes the other section. I want them to work as two individual tabs. Can anyone assist? I know very little knowledge of js unfortunately. Ive pasted the example of what im trying to do below. Thanks in advance. <!DOCTYPE html> <html> <title>W3.CSS</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <body> <div class="w3-container"> <h2>Tabs</h2> <p>Tabs are perfect for single page web applications, or for web pages capable of displaying different subjects. Click on the links below.</p> </div> <div class="w3-bar w3-black"> <button class="w3-bar-item w3-button" onclick="openCity('London1')">London1</button> <button class="w3-bar-item w3-button" onclick="openCity('Paris1')">Paris1</button> <button class="w3-bar-item w3-button" onclick="openCity('Tokyo1')">Tokyo1</button> </div> <div id="London1" class="w3-container city"> <h2>London1</h2> <p>London is the capital city of England.</p> </div> <div id="Paris1" class="w3-container city" style="display:none"> <h2>Paris1</h2> <p>Paris is the capital of France.</p> </div> <div id="Tokyo1" class="w3-container city" style="display:none"> <h2>Tokyo1</h2> <p>Tokyo is the capital of Japan.</p> </div> <div class="w3-bar w3-blue"> <button class="w3-bar-item w3-button" onclick="openCity('London2')">London2</button> <button class="w3-bar-item w3-button" onclick="openCity('Paris2')">Paris2</button> <button class="w3-bar-item w3-button" onclick="openCity('Tokyo2')">Tokyo2</button> </div> <div id="London2" class="w3-container city"> <h2>London2</h2> <p>London is the capital city of England.</p> </div> <div id="Paris2" class="w3-container city" style="display:none"> <h2>Paris2</h2> <p>Paris is the capital of France.</p> </div> <div id="Tokyo2" class="w3-container city" style="display:none"> <h2>Tokyo2</h2> <p>Tokyo is the capital of Japan.</p> </div> <div class="w3-container w3-red"> <h2>The Issue</h2> <p>I want the two tab sections to work indvidually of each other. I want to be able to click London 1 and it not close anything in tab bar 2 and vice versa.</p> </div> <script> function openCity(cityName) { var i; var x = document.getElementsByClassName("city"); for (i = 0; i < x.length; i++) { x[i].style.display = "none"; } document.getElementById(cityName).style.display = "block"; } </script> </body> </html>
  2. Hey @Ingolme, Thanks for your reply. Do you think it should work how i expected it too or is it working as expected. I thought that flat colours and the W3.CSS colours could all work with any of the W3.CSS classes. Thanks, Sam
  3. Hey, I'm having as issue which also appears in the TryIt editor. I don't know if its meant to work like I expected or it isn't. I'm trying to change the table header colour to "w3-flat-peter-river" (https://www.w3schools.com/w3css/w3css_color_flat.asp) which I've referenced from the w3-colors-flat.css stylesheet. The problem is, when the code is run, it just shows a white box with white font. If you change the colour to "w3-red" it works fine. Can you not use flat colours as table headers? Thanks. <!DOCTYPE html> <html> <title>W3.CSS</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <link rel="stylesheet" href="https://www.w3schools.com/lib/w3-colors-flat.css"> <body> <div class="w3-container"> <h2>Colored Table Heading</h2> <p>Use any of the w3-<em>color</em> classes to display a colored row:</p> <table class="w3-table-all"> <thead> <tr class="w3-flat-peter-river"> <th>First Name</th> <th>Last Name</th> <th>Points</th> </tr> </thead> <tr> <td>Jill</td> <td>Smith</td> <td>50</td> </tr> <tr> <td>Eve</td> <td>Jackson</td> <td>94</td> </tr> <tr> <td>Adam</td> <td>Johnson</td> <td>67</td> </tr> </table> </div> </body> </html>
×
×
  • Create New...