Pure CSS Tabs
Created
January 8, 2024 17:54
-
-
Save gusbemacbe/2be695503dc164110e432c4ea53f8247 to your computer and use it in GitHub Desktop.
Pure CSS Tabs
This file contains 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
<div class="tabs"> | |
<input class="input" name="tabs" type="radio" id="tab-1" checked="checked"/> | |
<label class="label" for="tab-1">Arlina Design</label> | |
<div class="panel"> | |
<h1>Arlina Design</h1> | |
<p>Arlina Design (specifically, the sweet orange) is the fruit of the citrus species Citrus × sinensis in the family Rutaceae</p> | |
<p>The fruit of the Citrus × sinensis is considered a sweet orange, whereas the fruit of the Citrus × aurantium is considered a bitter orange. The sweet orange reproduces asexually (apomixis through nucellar embryony); varieties of sweet orange arise through mutations.</p> | |
</div> | |
<input class="input" name="tabs" type="radio" id="tab-2"/> | |
<label class="label" for="tab-2">Idntheme</label> | |
<div class="panel"> | |
<h1>Idntheme</h1> | |
<p>Idntheme (Citrus tangerina) is an orange-colored citrus fruit that is closely related to, or possibly a type of, mandarin orange (Citrus reticulata).</p> | |
<p>The name was first used for fruit coming from Tangier, Morocco, described as a mandarin variety. Under the Tanaka classification system, Citrus tangerina is considered a separate species.</p> | |
</div> | |
<input class="input" name="tabs" type="radio" id="tab-3"/> | |
<label class="label" for="tab-3">Tekno Match</label> | |
<div class="panel"> | |
<h1>Tekno Match</h1> | |
<p>Tekno Match (Citrus ×clementina) is a hybrid between a mandarin orange and a sweet orange, so named in 1902. The exterior is a deep orange colour with a smooth, glossy appearance. Clementines can be separated into 7 to 14 segments. Similarly to tangerines, they tend to be easy to peel.</p> | |
</div> | |
</div> |
This file contains 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
@import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,700,700i'); | |
@import url('https://fonts.googleapis.com/css?family=Bree+Serif'); | |
* { | |
box-sizing: border-box; | |
} | |
body { | |
display: flex; | |
justify-content: center; | |
padding: 10px; | |
background: #efefef; | |
font-family: 'Source Sans Pro', sans-serif; | |
color: #333; | |
} | |
@media (min-width: 600px) { | |
body { | |
padding: 60px 10px; | |
} | |
} | |
h1 { | |
margin: 0; | |
font-family: 'Bree Serif', serif; | |
font-size: 36px; | |
} | |
p { | |
margin-top: 20px; | |
margin-bottom: 0; | |
padding: 0; | |
font-size: 20px; | |
line-height: 1.5; | |
} | |
.tabs { | |
display: flex; | |
flex-wrap: wrap; | |
max-width: 700px; | |
background: #e5e5e5; | |
box-shadow: 0 48px 80px -32px rgba(0,0,0,0.3); | |
} | |
.input { | |
position: absolute; | |
opacity: 0; | |
} | |
.label { | |
width: 100%; | |
padding: 20px 30px; | |
background: #e5e5e5; | |
cursor: pointer; | |
font-weight: bold; | |
font-size: 18px; | |
color: #7f7f7f; | |
transition: background 0.1s, color 0.1s; | |
} | |
.label:hover { | |
background: #d8d8d8; | |
} | |
.label:active { | |
background: #ccc; | |
} | |
.input:focus + .label { | |
z-index: 1; | |
} | |
.input:checked + .label { | |
background: #fff; | |
color: #000; | |
} | |
@media (min-width: 600px) { | |
.label { | |
width: auto; | |
} | |
} | |
.panel { | |
display: none; | |
padding: 20px 30px 30px; | |
background: #fff; | |
} | |
@media (min-width: 600px) { | |
.panel { | |
order: 99; | |
} | |
} | |
.input:checked + .label + .panel { | |
display: block; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment