Created
January 28, 2026 18:11
-
-
Save wpacademy/1fa8cdb2d8f7aae9cea8d42597918490 to your computer and use it in GitHub Desktop.
CSS corner-shape property usage example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>CSS corner-shape Property Demo</title> | |
| <style> | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| } | |
| body { | |
| background: #000; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| min-height: 100vh; | |
| font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; | |
| } | |
| .tab-container { | |
| display: flex; | |
| gap: 0; | |
| background: #2a2a2a; | |
| border-radius: 50px; | |
| position: relative; | |
| border: 2px solid #444; | |
| overflow: hidden; | |
| padding: 0; | |
| justify-content: stretch; | |
| align-items: stretch; | |
| font-size: 0; /* Remove whitespace between inline elements */ | |
| } | |
| .tab { | |
| display: flex; | |
| align-items: center; | |
| gap: 12px; | |
| padding: 16px 50px; | |
| background: transparent; | |
| color: #fff; | |
| font-size: 20px; /* Reset font-size here */ | |
| font-weight: 500; | |
| cursor: pointer; | |
| transition: all 0.2s ease; | |
| position: relative; | |
| white-space: nowrap; | |
| flex: 1; | |
| margin-right: -20px; /* Overlap tabs to eliminate gaps */ | |
| /* NEW CSS corner-shape property! */ | |
| corner-shape: bevel round; | |
| border-radius: 1em 0 / 3em 0; | |
| border-right: 3px solid #444; | |
| } | |
| /* First and last tab corner-shape adjustments */ | |
| .tab:first-child { | |
| margin-left: -30px; | |
| padding-left: 60px; | |
| } | |
| .tab:last-child { | |
| margin-right: -30px; | |
| padding-right: 60px; | |
| } | |
| /* Hover effect */ | |
| .tab:hover { | |
| background: rgba(255, 255, 255, 0.1); | |
| } | |
| /* Active state */ | |
| .tab.active { | |
| background: rgba(255, 255, 255, 0.1); | |
| } | |
| .tab-icon { | |
| width: 28px; | |
| height: 28px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| } | |
| /* Icon styles */ | |
| .icon-apps { | |
| width: 24px; | |
| height: 24px; | |
| display: grid; | |
| grid-template-columns: repeat(2, 10px); | |
| gap: 4px; | |
| } | |
| .icon-apps span { | |
| width: 10px; | |
| height: 10px; | |
| background: currentColor; | |
| border-radius: 3px; | |
| } | |
| .icon-settings { | |
| width: 28px; | |
| height: 28px; | |
| border: 2.5px solid currentColor; | |
| border-radius: 50%; | |
| position: relative; | |
| } | |
| .icon-settings::before { | |
| content: ''; | |
| position: absolute; | |
| width: 10px; | |
| height: 10px; | |
| background: currentColor; | |
| border-radius: 50%; | |
| top: 50%; | |
| left: 50%; | |
| transform: translate(-50%, -50%); | |
| } | |
| .icon-users { | |
| width: 28px; | |
| height: 28px; | |
| position: relative; | |
| } | |
| .icon-users::before, | |
| .icon-users::after { | |
| content: ''; | |
| position: absolute; | |
| border: 2.5px solid currentColor; | |
| border-radius: 50%; | |
| } | |
| .icon-users::before { | |
| width: 16px; | |
| height: 16px; | |
| top: 0; | |
| left: 6px; | |
| } | |
| .icon-users::after { | |
| width: 24px; | |
| height: 12px; | |
| bottom: 0; | |
| left: 2px; | |
| border-radius: 12px 12px 0 0; | |
| } | |
| /* Demo annotation */ | |
| .demo-note { | |
| position: absolute; | |
| bottom: -80px; | |
| left: 50%; | |
| transform: translateX(-50%); | |
| background: #1a1a1a; | |
| padding: 15px 25px; | |
| border-radius: 10px; | |
| border: 1px solid #3b82f6; | |
| color: #3b82f6; | |
| font-family: 'Courier New', monospace; | |
| font-size: 14px; | |
| white-space: nowrap; | |
| } | |
| .container-wrapper { | |
| position: relative; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="container-wrapper"> | |
| <div class="tab-container"> | |
| <div class="tab"> | |
| <div class="tab-icon icon-apps"> | |
| <span></span> | |
| <span></span> | |
| <span></span> | |
| <span></span> | |
| </div> | |
| <span>Apps</span> | |
| </div> | |
| <div class="tab"> | |
| <div class="tab-icon icon-settings"></div> | |
| <span>Settings</span> | |
| </div> | |
| <div class="tab"> | |
| <div class="tab-icon icon-users"></div> | |
| <span>Users</span> | |
| </div> | |
| </div> | |
| <div class="demo-note"> | |
| corner-shape: bevel; border-radius: 0 1em / 0 2.5em; | |
| </div> | |
| </div> | |
| <script> | |
| // Add click functionality | |
| const tabs = document.querySelectorAll('.tab'); | |
| tabs.forEach(tab => { | |
| tab.addEventListener('click', () => { | |
| tabs.forEach(t => t.classList.remove('active')); | |
| tab.classList.add('active'); | |
| }); | |
| }); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment