HTML 代码
<div class="relative group">
<a href="#main-content" class="inline-block px-4 py-2 text-white bg-blue-500 rounded-full shadow-lg transform transition-transform duration-300 ease-in-out hover:scale-105 hover:shadow-2xl dark:bg-blue-700 dark:shadow-lg dark:hover:scale-110">
Skip to Content
</a>
<div class="absolute left-0 translate-y-full opacity-0 group-hover:opacity-100 transition-opacity duration-300 ease-in-out">
<div class="bg-gray-800 dark:bg-gray-900 text-white text-xs rounded-lg p-2 shadow-lg">
Skip past navigation and other elements to main content.
</div>
</div>
</div>
<div id="main-content" class="mt-10 bg-gray-100 dark:bg-gray-800 p-6 rounded-lg shadow-md">
<h1 class="text-2xl font-bold text-gray-900 dark:text-white">Main Content Area</h1>
<p class="mt-4 text-gray-700 dark:text-gray-300">This is where the main content goes. You can add your text and images here.</p>
<img src="https://picsum.photos/600/400" alt="Random placeholder" class="mt-4 rounded-lg shadow-md">
<p class="mt-4 text-gray-700 dark:text-gray-300">You can use this space to illustrate the content being referred to by the 'Skip to Content' link.</p>
</div>
相关组件
跳至内容链接组件
一个视觉上吸引人的 3D 风格 Skip to Content 链接,可帮助用户绕过社交媒体界面上的导航菜单。该组件使用互补配色方案(蓝色和橙色),并通过阴影和变换实现 3D 效果。具有响应式设计和深色主题支持。该链接在聚焦或激活时固定在视区的左上角,使其易于键盘导航,同时在不使用时保持不显眼。
跳至内容链接
用于辅助功能的“跳至内容”链接组件,专为具有灰度配色方案的深色模式仪表板而设计。由于响应式和深色模式样式,它比较复杂。不使用 JavaScript。使用带有 dark: 前缀的 Tailwind CSS 来支持深色主题。