Pen Settings

HTML

CSS

CSS Base

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ add another resource

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.

Vue

              
                <template>
  <div class="example">
    <h1>Toggle Button Examples</h1>
    <section class="muting">
      <h2>Toggling Mute</h2>
      <button
        :aria-pressed="muted"
        @click="toggleMute()"
        :class="muted ? 'button pressed' : 'button'"
      >
        Mute
        <img
          aria-hidden="true"
          class="muteIcon"
          :src="muted ? unmutedIcon : mutedIcon"
        />
      </button>
    </section>

    <section class="visibility">
      <form action="">
        <h2>Toggling Visibility</h2>
        <label for="password">Password</label>
        <input
          name="password"
          id="password"
          :type="passwordHidden ? 'text' : 'password'"
          v-model="password"
          required
          aria-required="true"
        />
        <!-- Show/Hide buttons -->
        <span class="hideShow">
          <button
            type="button"
            aria-label="Show password"
            :aria-pressed="String(passwordHidden)"
            class="toggleHideButtons"
            @click="togglePasswordVisibility()"
          >
            <img
              aria-hidden="true"
              class="eyeIcons"
              :src="passwordHidden ? hideIcon : showIcon"
            />
          </button>
        </span>
      </form>
    </section>
  </div>
</template>

<script>
export default {
  data() {
    return {
      hideIcon:
        "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASgAAACrCAMAAADiivHpAAAAilBMVEX////u7u4AAADt7e339/fx8fH09PT5+fn7+/vq6upBQUFERETm5uY+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gra+WN5MAxbPY3Yl9wpLBcrAFEJQ7mJH4BFuzacnYWNdihSM1h1e+L9PWGBypSaO1FEGn2DVTJzlbP8zRAoflSPmW6WxJMWmpfE4HCdVTJzoIUJqorF6a1TLeRQgSTkEwiv1CtooyPSUgmEQsfdhjhZFfnjVoJizJUGuZL9RI1KIE/mx3l+XZVU1RcoxMe/fYStQSKOWb/aczdxobfDHY98jZPwYGolr1vWFG/AlC4h7wW30A1REU0+mrMr6ENCJT12ThU1GbV79XInWLfO0j/hwhtou5qOA2uzI0EJyQJyXzLAklC6pSLZbAbJLWLwwC/dUzIl/Ibef8y3T0ehOplcNZFBXufzogYTNQv4sIcRa2QWvPhRf1KQLHiGZ81P4GoXwoopr2ZVXAKUfuX6cYWPt77ME5xu6i78K6tbmF3UZmZ02QmOB3ToDNzI/t3dSSpifJ8VRPl+Wq+lWDsQE4TyttgB4mSHSOIKt2iih6iXrRTbPBmpxK1BIo5Zv+4XZjxBLt+A/UN1AmBGu5K/QKBcu3Q1jLd9drDee9dnBIG2SElnKjGBLFMcqXMaaJWD0I184nsSUjclcbUid0pefdn179Md48HoYZzijvbxv+wTPeYXJjTifoN1DdQ30B9AzVqoP4HT721x+bJOokAAAAASUVORK5CYII=",
      showIcon:
        "https://e7.pngegg.com/pngimages/244/518/png-clipart-eye-icon-eye-service-people.png",
      mutedIcon:
        "https://img1.pnghut.com/1/25/12/1p2vWF0Wyj/volume-symbol-hand-sound-icon-text.jpg",
      unmutedIcon:
        "https://www.clipartmax.com/png/middle/311-3112266_mute-no-cell-phones-no-cellphone-icon-mute-unmute-icon-png.png",
      muted: false,
      password: "",
      passwordHidden: false
    };
  },
  methods: {
    toggleMute() {
      this.muted = !this.muted;
    },
    togglePasswordVisibility() {
      this.passwordHidden = !this.passwordHidden;
    }
  }
};
</script>

<style>
.example {
  margin: 20px;
}
.visibility label {
  display: block;
}

.toggleHideButtons {
  background-color: transparent;
  border: none;
  padding: 0;
  margin: 0.5em;
}
.hideShow {
  vertical-align: middle;
}
.eyeIcons {
  height: 1.8em;
  background-color: none;
}
.muteIcon {
  height: 1.5em;
  background-color: none;
}
.button {
  border: 1px solid gray;
  border-radius: 5px;
  font-weight: bold;
  padding: 5px 10px;
  font-size: 1em;
}
.pressed {
  box-shadow: 1px 1px 2px grey;
  background-color: #dedede;
}

*:focus {
  outline: none;
  border: 1px solid blue;
}
</style>

              
            
!
999px

Console