css实现带tab选项卡切换的个人信息卡片效果代码
代码语言:html
所属分类:选项卡
代码描述:css实现带tab选项卡切换的个人信息卡片效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap" rel="stylesheet">
<style>
:root {
--primary: #5F5DFE;
--primary-darker: #4F4DFE;
--bg: #EFF3F4;
--white: #FFF;
--profile-bg: #FFFFFD;
--socials-bg: #F9FAFC;
--highlight-bg: #F9FAFC;
--text-bg: #878789;
--text: #797C83;
--border-color: #F4F4F4;
--social-color: #6B6C6E;
--active: #7774B5;
--tab-bg: #EBE9FF;
--tabs-border: #F2F6F5;
--tab-width: 7rem;
--tabs-gap: 0rem;
--tab-radius: 0.4rem;
--scrollbar-thumb: #e4e3f3;
--scrollbar-bg: #F2F6F5;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
*:focus {
outline: 1px solid var(--primary);
outline-offset: 0;
}
*::selection {
background: var(--primary);
color: var(--white);
}
*::-webkit-scrollbar {
width: 0.5rem;
height: 0.5rem;
background: var(--scrollbar-bg);
border-radius: 9.99rem;
}
*::-webkit-scrollbar-thumb {
background: var(--scrollbar-thumb);
border-radius: 9.99rem;
}
body {
font-family: 'Manrope', sans-serif;
background: var(--bg);
color: var(--text);
display: flex;
justify-content: center;
flex-direction: column;
height: 100vh;
user-select: none;
}
.profile {
background: var(--profile-bg);
padding: 1rem;
border-radius: 1rem;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 28rem;
min-width: 20rem;
margin: 0 auto;
gap: 0.75rem;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
}
.profile__highlight__wrapper {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.35rem;
font-size: 0.8rem;
width: 100%;
flex-grow: 1;
}
.profile__highlight {
padding: 0.4rem;
border-radius: 0.5rem;
font-weight: 600;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
gap: 0.25rem;
background: var(--highlight-bg);
border: 1px solid var(--border-color);
}
.profile__header {
display: flex;
justify-content: space-between;
align-items: start;
width: 100%;
gap: 0.75rem;
}
.profile__name {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
gap: 0.25rem;
}
.profile__name h2 {
display: flex;
align-items: center;
font-size: 1.5rem;
gap: 0.5rem;
}
.profile__name p {
font-size: 1.05rem;
color: var(--text-bg);
}
.profile__avatar {
flex-grow: 3;
max-width: 8rem;
min-width: 5rem;
}
.profile__avatar img {
position: relative;
width: 100%;
aspect-ratio: 1/1;
object-fit: cover;
border-radius: 1rem;
margin: 0 auto;
margin-top: -50%;
border: 4px solid var(--profile-bg);
}
.social-links {
display: flex;
margin: 0.5rem auto 1rem auto;
width: 100%;
justify-content: center;
list-style-type: none;
gap: 1rem;
flex-wrap: wrap;
}
.social-links a {
background: var(--socials-bg);
padding: 0.5rem;
border-radius: 0.5rem;
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0