screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <script src="https://unpkg.com/react@17.0.2/umd/react.development.js"></script> <script src="https://unpkg.com/react-dom@17.0.2/umd/react-dom.development.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script> </head> <body> <div id="app"></div> <script type="text/babel"> const { useState } = React; function App() { const [text, setText] = useState("React js Replace spaces And Special Character with dashes and make all letters lower-case"); const convertedText = text.toLowerCase().replace(/[^a-zA-Z0-9]+/g, "-"); return ( <div className='container'> <h3>React js Replace spaces And Special Character with dashes and make all letters lower-case</h3> <input value={text} onChange={(e) => setText(e.target.value)} type="text" /> <p>URL: {convertedText}</p> </div> ); } ReactDOM.render(<App />, document.getElementById('app')); </script> <style> .container { max-width: 800px; margin: 0 auto; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); text-align: center; } input { width: 100%; height: 40px; text-align: center; font-size: 24px; margin: 0; padding-left: 0; border: none; border-bottom: 2px solid #ccc; box-shadow: none; background-color: #f5f5f5; color: #333; transition: all 0.3s ease-in-out; font-family: Arial, Helvetica, sans-serif; } input:focus { outline: none; border-bottom-color: #007bff; } </style> </body> </html>