Nature Tree Diagram - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Nature Tree Diagram</title> <style> body { font-family: 'Arial', sans-serif; background: linear-gradient(120deg, #a1c4fd, #c2e9fb); display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .tree { display: flex; flex-direction: column; align-items: center; position: relative; } .tree ul { padding-top: 20px; position: relative; transition: all 0.5s; display: flex; justify-content: center; } .tree li { list-style-type: none; margin: 0 10px; text-align: center; position: relative; padding: 20px 5px 0 5px; } .tree li::before, .tree li::after { content: ''; position: absolute; top: 0; right: 50%; border-top: 2px solid #8bc34a; width: 50%; height: 20px; } .tree li::after { right: auto; left: 50%; border-left: 2px solid #8bc34a; } .tree li:only-child::after, .tree li:only-child::before { display: none; } .tree li:only-child { padding-top: 0; } .tree li:first-child::before, .tree li:last-child::after { border: 0 none; } .tree li:last-child::before { border-right: 2px solid #8bc34a; border-radius: 0 5px 0 0; } .tree li:first-child::after { border-radius: 5px 0 0 0; } .tree ul ul::before { content: ''; position: absolute; top: 0; left: 50%; border-left: 2px solid #8bc34a; width: 0; height: 20px; } .tree li a { border: 2px solid #8bc34a; padding: 10px 20px; text-decoration: none; color: #4caf50; font-family: 'Arial', sans-serif; font-size: 18px; display: inline-block; border-radius: 5px; transition: all 0.3s; position: relative; background: #fff; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1); display: flex; align-items: center; justify-content: center; } .tree li a .icon { margin-right: 10px; font-size: 24px; } .tree li a:hover, .tree li a:focus { background: #f5f5f5; color: #000; border-color: #7cb342; box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15); } .tree li a:hover .icon, .tree li a:focus .icon { animation: bounce 0.6s; } @keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-10px); } 60% { transform: translateY(-5px); } } .tree li a span { font-size: 16px; } .tree .tooltip { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #333; color: #fff; padding: 5px 10px; border-radius: 3px; font-size: 14px; opacity: 0; visibility: hidden; transition: all 0.3s; white-space: nowrap; } .tree li a:hover .tooltip, .tree li a:focus .tooltip { opacity: 1; visibility: visible; bottom: 110%; } .tree li a::before { content: '🌳'; position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 20px; } </style> </head> <body> <div class="tree"> <ul> <li> <a href="#"><span class="icon">🌲</span><span>Root</span> <div class="tooltip">Root Node</div> </a> <ul> <li> <a href="#"><span class="icon">🍃</span><span>Branch 1</span> <div class="tooltip">Branch Node 1</div> </a> <ul> <li> <a href="#"><span class="icon">🍁</span><span>Leaf 1</span> <div class="tooltip">Leaf Node 1</div> </a> </li> <li> <a href="#"><span class="icon">🍂</span><span>Leaf 2</span> <div class="tooltip">Leaf Node 2</div> </a> </li> </ul> </li> <li> <a href="#"><span class="icon">🍃</span><span>Branch 2</span> <div class="tooltip">Branch Node 2</div> </a> <ul> <li> <a href="#"><span class="icon">🍁</span><span>Leaf 3</span> <div class="tooltip">Leaf Node 3</div> </a> </li> <li> <a href="#"><span class="icon">🍂</span><span>Leaf 4</span> <div class="tooltip">Leaf Node 4</div> </a> </li> </ul> </li> </ul> </li> </ul> </div> </body> </html>