IT 노하우

HTML·CSS Tab Menu (use CSS)

페이지 정보

본문

<style>
/*--------------------------
* Menu Tabular solo Con CSS
*---------------------------*/
 
* {
  margin: 0;
  padding: 0;
}
 
body {
  background: linear-gradient(to left, #4bd0e4, #7fbac6);
  font-size: 68.5%;
  font-family: "Open Sans", Arial, Helvetica, Sans-serif;
}
a {
  color: #31a687;
  font-weight: bold;
  text-decoration: none;
}
h1 {
  color: #fff;
  font-size: 3.2em;
  font-weight: 400;
  margin-bottom: 20px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
/*--------------------------
* MENU TABS
---------------------------*/
.menu .state {
  position: absolute;
  display: none;
}
.menu_tabs {
  overflow: hidden;
}
.menu_tabs label {
  float: left;
  margin-right: 2px;
  font-size: 1.3em;
  padding: 1em;
  background: #636b68;
  display: inline-block;
  color: #fff;
  text-decoration: none;
  -webkit-border-radius: 4px 4px 0 0;
  -moz-border-radius: 4px 4px 0 0;
  border-radius: 4px 4px 0 0;
  -webkit-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
  -webkit-box-shadow: inset 0 -2px 5px rgba(0, 0, 0, 0.2);
  -moz-box-shadow: inset 0 -2px 5px rgba(0, 0, 0, 0.2);
  box-shadow: inset 0 -2px 5px rgba(0, 0, 0, 0.2);
}
.menu_tabs label:hover {
  background: #414a68;
}
 
#tab-1:checked ~ .menu_tabs #tab-l1,
#tab-2:checked ~ .menu_tabs #tab-l2,
#tab-3:checked ~ .menu_tabs #tab-l3,
#tab-4:checked ~ .menu_tabs #tab-l4,
#tab-5:checked ~ .menu_tabs #tab-l5,
#tab-6:checked ~ .menu_tabs #tab-l6 {
  color: #333b48;
  background: #fff;
  -webkit-box-shadow: none;
  -moz-box-shadow: none;
  box-shadow: none;
}
 
/*--------------------------
* MENU WRAPPER
---------------------------*/
.menu {
  margin: 20px auto;
  width: 80%;
  max-width: 1280px;
  position: relative;
}
.menu_panel {
  padding: 2em;
  position: relative;
  z-index: 400;
  background: #fff;
  min-height: 720px;
  -webkit-border-radius: 0 4px 4px 4px;
  -moz-border-radius: 0 4px 4px 4px;
  border-radius: 0 4px 4px 4px;
}
 
.menu_panel .panel {
  line-height: 1.3;
  color: #76716f;
  display: none;
}
 
.menu_panel .panel h3 {
  font-size: 1.8em;
  color: #333b48;
  border-bottom: 1px solid #d9d9d9;
  padding-bottom: 5px;
  margin-bottom: 12px;
}
.menu_panel .panel p {
  font-size: 1.3em;
  line-height: 1.6em;
  color: #76716f;
}
 
#tab-1:checked ~ .menu_panel #tab_p1,
#tab-2:checked ~ .menu_panel #tab_p2,
#tab-3:checked ~ .menu_panel #tab_p3,
#tab-4:checked ~ .menu_panel #tab_p4,
#tab-5:checked ~ .menu_panel #tab_p5,
#tab-6:checked ~ .menu_panel #tab_p6 {
  display: block;
}
</style>
<div class="menu">
  <h1 class="shimmer">CSS Tab Menu</h1>
  <input class="state" type="radio" title="tab-1" name="tabs-state" id="tab-1" checked />
  <input class="state" type="radio" title="tab-2" name="tabs-state" id="tab-2" />
  <input class="state" type="radio" title="tab-3" name="tabs-state" id="tab-3" />
  <input class="state" type="radio" title="tab-4" name="tabs-state" id="tab-4" />
  <input class="state" type="radio" title="tab-5" name="tabs-state" id="tab-5" />
  <input class="state" type="radio" title="tab-6" name="tabs-state" id="tab-6" />
  <div class="menu_tabs">
    <label id='tab-l1' for='tab-1'><i class=""></i> Uno</label>
    <label id='tab-l2' for='tab-2'><i class=""></i> Dos</label>
    <label id='tab-l3' for='tab-3'><i class=""></i> Tres</label>
    <label id='tab-l4' for='tab-4'><i class=""></i> Cuatro</label>
    <label id='tab-l5' for='tab-5'><i class=""></i> Speech</label>
  </div>
  <section class="menu_panel">
    <article id="tab_p1" class="panel active">
      <h3>테스트 Uno</h3>
      <p>탭 메뉴를 테스트중입니다. </p>
    </article>
 
    <article id="tab_p2" class="panel">
      <h3>Contenido Dos</h3>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis, dignissimos nam dolor est. Ad vel eum voluptates rerum. Harum quia dolore architecto ducimus, rem porro minus perferendis ab eveniet aliquid!</p>
    </article>
 
    <article id="tab_p3" class="panel">
      <h3>Contenido Tres</h3>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis, dignissimos nam dolor est. Ad vel eum voluptates rerum. Harum quia dolore architecto ducimus, rem porro minus perferendis ab eveniet aliquid!</p>
    </article>
 
    <article id="tab_p4" class="panel">
      <h3>Accent-Color 테스트 Cuatro</h3>
      <p><input type=checkbox><input type="checkbox" class="custom" checked /><input type="radio">
        <!--라디오버튼-->
        <input type="range">
        <!--범위-->
        <progress></progress>
      </p>
    </article>
    <article id="tab_p5" class="panel">
      <h3>Speak Test</h3>
      <p>스크립트 제거 -0- </p>
    </article>
  </section>
</div>