Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <form>
<input type="text" class="input-text" placeholder="name">
<input type="email" class="input-email" name="" id="" placeholder="sample@gmail.com">

<label class="check-label"><input class="check-test" type="checkbox" name="check-name"><span class="check-label-span">チェック1</span></label>
<label class="check-label"><input class="check-test" type="checkbox" name="check-name"><span class="check-label-span">チェック2</span></label>
<label class="check-label"><input class="check-test" type="checkbox" name="check-name"><span class="check-label-span">チェック3</span></label>
<label class="radio-label"><input class="radio-test" type="radio" name="radio-name"><span
class="radio-label-span">ラジオ1</span></label>
<label class="radio-label"><input class="radio-test" type="radio" name="radio-name"><span
class="radio-label-span">ラジオ2</span></label>
<label class="radio-label"><input class="radio-test" type="radio" name="radio-name"><span
class="radio-label-span">ラジオ3</span></label>
  <div class="custom-file-upload">
  <input type="file" class="input-file" id="fileInput" aria-label="ファイルを選択">
  <button type="button" id="fileLabel" onclick="triggerFileInput()">ファイルを選択</button>
  <button type="button" onclick="clearFile()">クリア</button>
</div>
<div class="select-container">
  <select class="select-box" name="都道府県を選んで下さい。" id="">
    <option value="sample">サンプル1</option>
    <option value="sample">サンプル2</option>
    <option value="sample">サンプル3</option>
    <option value="sample">サンプル4</option>
    <option value="sample">サンプル5</option>
  </select>
</div>
<textarea class="textarea-box" rows="5" cols="30"></textarea>
<input type="submit" class="input-submit" value="送信する">
  </form>
              
            
!

CSS

              
                .input-text, .input-email, .input-file, .input-submit {
  padding: 0;
  border: none;
  border-radius: 0;
  outline: none;
  background: none;
  box-shadow: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  /* リセットじゃない部分 */
  border: 1px solid rgba(0, 0, 0, 0.16);
}
.input-text:focus,
.input-email:focus {
  outline: 2px solid #3498db;
  /* 自由な色に変更可能 */
  outline-offset: 0;
}
.check-test {
  position: absolute;
  opacity: 0;
  z-index: -1;
}

.check-label {
  position: relative;
  display: inline-block;
  padding-left: 30px;  /* カスタムチェックボックスにスペースを確保 */
  margin-bottom: 5px;
  cursor: pointer;
}

/* Custom Checkbox Design */
.check-label-span::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #000; /* Border color */
  border-radius: 4px; /* Optional: for rounded corners */
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* Custom Checkbox Checked State */
.check-test:checked + .check-label-span::before {
  border-color: #3498db; /* Border color when checked */
}

.check-test:checked + .check-label-span::after {
  content: "";
  display: block;
  width: 5px;
  height: 10px;
  border: solid #000;
  border-width: 0 2px 2px 0;
  position: absolute;
  top: 50%;
  left: 8px;  /* Adjusted position */
  transform: translateY(-50%) rotate(45deg);
}

/* Focus State */
.check-test:focus + .check-label-span::before {
  outline: 2px solid #3498db; /* Outline color when focused */
}
/* Hide default radio button */
.radio-test {
  position: absolute;
  opacity: 0;
  z-index: -1;
}

/* Label positioning context */
.radio-label {
  position: relative;
  display: inline-block;
  padding-left: 30px;  /* Space for the custom radio button */
  margin-bottom: 5px;
  cursor: pointer;
}

/* Custom Radio Button Design */
.radio-label-span::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #000; /* Border color */
  border-radius: 50%; /* Rounded corners for radio button */
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* Custom Radio Button Checked State */
.radio-test:checked + .radio-label-span::after {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  background-color: #000; /* Fill color when checked */
  border-radius: 50%; /* Rounded corners for checked state */
  position: absolute;
  top: 50%;
  left: 7px;  /* Centering the filled circle */
  transform: translateY(-50%);
}

/* Focus State */
.radio-test:focus + .radio-label-span::before {
  outline: 2px solid #3498db; /* Outline color when focused */
}
/* Style for the select box container */
.select-container {
  position: relative;
  display: inline-block;
  width: 200px; /* Set a width */
  margin-bottom: 20px;
}

/* Style for the select box */
.select-box {
  padding: 10px;
  border: 2px solid #000;
  border-radius: 4px;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%; /* Make it fill the container */
  font-size: 16px;
  color: #000;
}

/* Arrow icon using a pseudo-element */
.select-container::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 10px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #000;
  transform: translateY(-50%);
}

/* Focus State */
.select-box:focus {
  border-color: #3498db; /* Border color when focused */
}
/* Style for the text area */
.textarea-box {
  width: 100%; /* Set the width */
  padding: 10px; /* Set padding */
  border: 2px solid #000; /* Set border */
  border-radius: 4px; /* Optional: for rounded corners */
  font-size: 16px; /* Set font size */
  resize: vertical; /* Allow vertical resize */
  outline: none; /* Remove outline */
  box-sizing: border-box; /* Include border and padding in the element's dimensions */
  margin-bottom: 20px;
}
/* Style for the submit button */
.input-submit {
  padding: 10px 20px; /* Set padding */
  border: none; /* Remove border */
  border-radius: 4px; /* Optional: for rounded corners */
  background-color: #3498db; /* Set background color */
  color: #fff; /* Set text color */
  font-size: 16px; /* Set font size */
  cursor: pointer; /* Set cursor to pointer */
  transition: background-color 0.3s; /* Optional: for smooth color transition */
  text-align: center;
}

/* Hover State */
.input-submit:hover {
  background-color: #2980b9; /* Darken background color when hovered */
}

/* Active State */
.input-submit:active {
  background-color: #1c598a; /* Darken background color when active */
}

/* Focus State */
.input-submit:focus {
  outline: none; /* Remove outline */
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.5); /* Add a soft outline */
}
.custom-file-upload {
  position: relative;
  display: inline-block;
}

.input-file {
  display: none;
}

.custom-file-upload button {
  padding: 10px;
  border: 2px solid #000;
  background-color: #f0f0f0;
  border-radius: 4px;
  cursor: pointer;
  color: #000;
}

.custom-file-upload button:hover {
  background-color: #d0d0d0;
}

.custom-file-upload button:focus {
  border-color: #3498db; /* Border color when focused */
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.5); /* Add a soft outline */
}
              
            
!

JS

              
                const fileInput = document.getElementById('fileInput');
    const fileLabel = document.getElementById('fileLabel');

    function triggerFileInput() {
        fileInput.click();
    }

    fileInput.addEventListener('change', () => {
        const fileName = fileInput.files[0] ? fileInput.files[0].name : 'ファイルを選択';
        fileLabel.textContent = fileName;
    });

    function clearFile() {
        fileInput.value = '';
        fileLabel.textContent = 'ファイルを選択';
    }
              
            
!
999px

Console