Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <h2>今の気分は?</h2>
<ul class="radio-select">
  <li>
    <input type="radio" id="check1" name="check" />
    <label for="check1"></label>
    <div class="choice-btn"><i class="far fa-smile-beam"></i></div>
    <p>SMILE</p>
  </li>
  <li>
    <input type="radio" id="check2" name="check" />
    <label for="check2"></label>
    <div class="choice-btn"><i class="far fa-smile"></i></div>
    <p>NORMAL</p>
  </li>
  <li>
    <input type="radio" id="check3" name="check" />
    <label for="check3"></label>
    <div class="choice-btn"><i class="far fa-angry"></i></div>
    <p>ANGRY</p>
  </li>
  <li>
    <input type="radio" id="check4" name="check" />
    <label for="check4"></label>
    <div class="choice-btn"><i class="far fa-sad-cry"></i></div>
    <p>CRY</p>
  </li>
</ul>
              
            
!

CSS

              
                body {
	background: #75c1d0;
	max-width: 40rem;
	margin: auto;
}
h2 {
	text-align: center;
	margin-bottom: 3rem;
}
.radio-select li {
	display: inline-block;
	border-radius: 5px;
	position: relative;
	margin: 0 1rem;
}
/* input は隠す */
.radio-select input {
  display: none;
}
/* labelはz-index1 で上に持ってくる */
.radio-select label {
	display: block;
	width: 100px;
	height: 100px;
	position: relative;
  z-index: 1;
}
/* labelの下に表示させる要素のスタイルを position absolute で指定 */
.radio-select .choice-btn {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	right: 0;
  text-align: center;
	background: #fff;
	border: 10px solid transparent;
	border-radius: 50%;
  box-sizing: border-box;
	transition: .4s;
}
/* font-awsome のアイコンを使用しています。画像などなんでも良いと思います。*/
.radio-select i {
  font-size: 5rem;
	transition: .4s;
}
.radio-select p {
	position: fixed;
	top: 4rem;
	left: 0;
  left: 50%;
  transform: translateX(-50%);
	margin: auto;
	width: 7rem;
	text-align: center;
	z-index: 2;
	opacity: 0;
	transition: .4s;
	background: white;
	border-radius: 2rem;
	font-weight: bold;
	
}
/* マウスオーバー時のスタイル */
.radio-select label:hover {
  cursor: pointer;
}
.radio-select input[type="radio"]:checked + label + .choice-btn i,
.radio-select li:hover i {
	transform: scale(1.1);
}
/* 選択時のスタイル(要素毎に色を替えています) */
.radio-select li:nth-child(1) input[type="radio"]:checked + label + .choice-btn {
	background: #FBFFB9;
}
.radio-select li:nth-child(2) input[type="radio"]:checked + label + .choice-btn {
	background: #D3F8E2;
}
.radio-select li:nth-child(3) input[type="radio"]:checked + label + .choice-btn {
	background: #EEC0C6;
}
.radio-select li:nth-child(4) input[type="radio"]:checked + label + .choice-btn {
	background: #BCC4DB;
}
.radio-select input[type="radio"]:checked + label + .choice-btn + p {
	opacity: 1;
}


              
            
!

JS

              
                
              
            
!
999px

Console