gpt-3.5-turbo-0613· openai
Suzhen/CodeChat
basic html responsive structure
- User
basic html responsive structure
- Assistant
/* Style the navigation menu */ nav { background-color: lightgray; padding: 10px; } /* Style the main content container */ main { background-color: white; padding: 10px; } /* Style the footer */ footer { background-color: lightgray; padding: 10px; } /* Apply media queries for responsiveness */ @media (max-width: 600px) { /* Make the columns stack on top of each other */ header, nav, main, footer { width: 100%; } } </style><nav> <ul> <li><a href="#">Home</a></li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li> </ul> </nav> <main> <h2>Main Content</h2> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla feugiat viverra eros, at tincidunt justo varius a. Duis cursus, metus ut egestas pharetra, dolor lectus sagittis nibh, at pulvinar ligula est eget mi. Etiam suscipit ligula sit amet tempor commodo. Proin non lacus vitae felis tristique vulputate at eget nunc. Vivamus sit amet convallis dolor. Donec id erat enim.</p> </main> <footer> <p>© 2021 This is a basic HTML responsive structure.</p> </footer> - User
use javascript to add class to an element with class name zinga
- Assistant
You can use JavaScript to add a class to an element with a specific class name using the
querySelectormethod and theclassListproperty. Here's an example:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Add Class with JavaScript</title> <style> .zinga { color: red; } </style> <script> document.addEventListener('DOMContentLoaded', function() { var element = document.querySelector('.zinga'); if (element) { element.classList.add('new-class'); } }); </script> </head> <body> <div class="zinga">Hello, World!</div> </body> </html>In the JavaScript code above, the
querySelectormethod is used to select the first element with the class name "zinga". Then, theclassListproperty is used to add the class "new-class" to the element. The ".zinga" class is defined in the CSS to set the color to red.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.