JSFiddle - React, Tailwind, and code Playground

by agus makmun

HTML

<main>

  <h4><a href="http://www.tutorial-webdesign.com">Tutorial Web Design.com</a></h4>
  <h2>CSS Tabs</h2>
  <input id="tab1" type="radio" name="tabs" checked>
    <label for="tab1">Home</label>
  <input id="tab2" type="radio" name="tabs">
    <label for="tab2">About</label>
  <input id="tab3" type="radio" name="tabs">
    <label for="tab3">Contact</label>
  <input id="tab4" type="radio" name="tabs">
    <label for="tab4">Social Media</label>

  <section id="content1">
    <h3>Selamat Datang TWDers</h3>
    <p>Content....</p>
  </section>
  <section id="content2">
    <h3>About TWD</h3>
    <p>Content....</p>
  </section>
  <section id="content3">
    <h3>Contact TWD</h3>
    <p>Content....</p>
  </section>
  <section id="content4">
    <h3>Social Media</h3>
    <p>Content...</p>
  </section>
</main>

CSS

@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700);

body {
  background: #5B264E;
  font-family: "Open Sans", "Arial";
}
a{
  text-decoration: none;
  color: #000;
}
a:hover{
  color: #B7977B;
}
main {
  background: #FFF;
  width: 500px;
  margin: 50px auto;
  padding: 10px 30px 80px;
  box-shadow: 0 3px 5px rgba(0,0,0,0.2);
}
p {
  font-size: 13px;
}

/* Important code */
input, section {
  clear: both;
  padding-top: 10px;
  display: none;
}
label {
  font-weight: bold;
  font-size: 14px;
  display: block;
  float: left;
  padding: 10px 30px;
  border-top: 2px solid transparent;
  border-right: 1px solid transparent;
  border-left: 1px solid transparent;
  border-bottom: 1px solid #DDD;
}
label:hover {
  cursor: pointer;
  text-decoration: underline;
}
#tab1:checked ~ #content1, #tab2:checked ~ #content2, #tab3:checked ~ #content3, #tab4:checked ~ #content4 {
  display: block;
}
input:checked + label {
  border-top-color: #B7977B;
  border-right-color: #DDD;
  border-left-color: #DDD;
  border-bottom-color: transparent;
  text-decoration: none;
}




/* Use Css Hover 
#tab1:hover ~ #content1, #tab2:hover ~ #content2, #tab3:hover ~ #content3, #tab4:hover ~ #content4 {
display: block;
}
*/