css+js实现找工作tab选项卡列表切换代码
代码语言:html
所属分类:选项卡
代码描述:css+js实现找工作tab选项卡列表切换代码
代码标签: css js 找工作 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=Mulish&display=swap" rel="stylesheet" type='text/css'> <style> :root { --background: white; --tabs-bg: white; --border: #DEE2E1; --text-color: #333531; --primary: #0D5E77; --scrollbar-bg: #EDF7F9; --scrollbar-thumb: #0D5E7740; --job-bg: #EDF7F9; --link-color: white; } body { font-family: Mulish, sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; color: var(--text-color); background: var(--background); user-select: none; padding: 1rem; } * { margin: 0; padding: 0; box-sizing: border-box; } .job-board { padding: 1.25rem; width: 100%; max-width: 40rem; border-radius: 1.5rem; background: var(--job-bg); border: 1px solid var(--border); } .job-board__top { display: flex; justify-content: start; align-items: center; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; } .job-board__headline { width: 100%; display: flex; gap: 0.5rem; font-weight: 700; align-items: center; } .job-board__headline svg { color: var(--text-color); height: 2rem; width: 2rem; } .job-board__description { width: 100%; } header { position: relative; } .tab-content { display: none; } .tab-content--active { display: flex; flex-direction: column; gap: 0.75rem; height: 30rem; padding-right: 0.5rem; overflow-y: scroll; } *::-webkit-scrollbar { width: 0.5rem; height: 0.5rem; background: var(--scrollbar-bg); border-radius: 9.99rem; } *::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); transition: all 0.2s ease-in-out; border-radius: 9.99rem; } *::-webkit-scrollbar-thumb:hover { background: var(--primary); } .tabs { position: relative; display: flex; gap: 0.5rem; flex-wrap: nowrap; margin-bottom: 0.75rem; overflow-x: auto; } .tabs>a { position: relative; display: flex; text-decoration: none; padding: 0.5rem; white-space: nowrap; font-weight: 600; text-align: left; justify-content: start; color: var(--text-color); transition: all 0.2s ease-in-out; align-items: center; gap: 0.5rem; border: 1px solid var(--border); color: var(--text-color); border-radius: 0.6rem; } .tabs>:not(.active):hover { color: var(--primary); border: 1px solid var(--primary); } .tabs>.active { font-weight: 700; background: var(--primary); border: 1px solid var(--primary); color: white; } .job { display: flex; flex-direction: column; justify-content: start; align-items: center; gap: 0.75rem; min-width: 20rem; height: fit-content; padding: 1rem; opacity: 1; border-radius: 1rem; background: var(--job-bg); } .job__avatar { display: block; border-radius: 1rem; flex-grow: 0; height: 4rem; width: 4rem; object-fit: contain; } .job__main { display: flex; gap: 1rem; width: 100%; } .job__bottom { display: flex; flex-direction: row; justify-content: space-between; gap: 0.5rem; width: 100%; } .job__applicants { display: flex; align-items: center; gap: 0.25rem; color: var(--text-color); } .job__applicants img:nth-child(n+2) { margin-left: -0.75rem; } .job__applicant { height: 1.75rem; width: 1.75rem; border-radius: 50%; object-fit: cover; border: 2px solid var(--background); } .job__name { font-weight: 700; display: flex; color: var(--text-color); align-items: center; justify-content: space-between; } .job__company { font-size: 0.875rem; margin-bottom: 0.75rem; color: var(--primary); } .job__description { display: flex; flex-direction: column; width: 100%; color: var(--text-color); } .job__location { display: flex; align-items: center; gap: 0.5rem; } .job__location img { height: 1.25rem; width: 1.25rem; } .job__bookmark { margin-left: auto; background: none; border: none; } .job__bookmark svg { height: 1.75rem; width: 1.75rem; cursor: pointer; transition: all 0.2s ease-in-out; stroke: var(--primary); } .job__bookmark svg:hover { fill: var(--primary); } .job__salary { font-weight: 700; color: var(--primary); } </style> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/purify.js"></script> </head> <body> <article class="job-board"> <div class="job-board__top"> <div class="job-board__headline"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-briefcase"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 7m0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v9a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z" /><path d="M8 7v-2a2 2 0 0 1 2 -2h4a2 2 0 0 1 2 2v2" /><path d="M12 12l0 .01" /><path d="M3 13a20 20 0 0 0 18 0" /></svg> <h2> Job board </h2> </div> <div class="job-board__description"> Find a job you love! </div> </div> <header> <div class="tabs"> <a id="tab1" name="all" href="#tab1"> New </a> <a id="tab4" name="remote" href="#tab4"> Remote </a> <a id="tab3" name="on-site" href="#tab3"> On-Site </a> .........完整代码请登录后点击上方下载按钮下载查看
网友评论0