移動端水平導航滾動條
阿新 • • 發佈:2020-09-17
頁面效果:
CSS實現:
<!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> * { margin: 0; padding: 0; } nav { width: 100%; overflow-x: auto; } ul { list-style: none; display: flex; white-space: nowrap; } li { margin: 0 10px; padding: 14px 0; } nav::-webkit-scrollbar { /* 隱藏滾動條 */ display: none; } </style> </head> <body> <nav> <ul> <li>導航1</li> <li>導航2</li> <li>導航3</li> <li>導航4</li> <li>導航5</li> <li>導航6</li> <li>導航7</li> <li>導航8</li> </ul> </nav> </body> </html>