function() { for (let i = 0; i < localStorage.length; i++) { let key = localStorage.key(i) let value = localStorage.getItem(key) console.log(key + ":" + value) } }
|
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> ul { list-style: none; display: flex; width: 90%; justify-content: center; } li { flex: 1; border: 1px solid #ccc; height: 50px; text-align: center; box-sizing: border-box; } </style> </head> <body> <ul> <li>1</li> <li>1</li> <li>1</li> </ul> </body> </html>