Pen Settings



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


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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


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.


                <mi-mensaje msj="Hola, soy un mensaje"></mi-mensaje>
<mi-mensaje casi-visible msj="Hola, soy un mensaje casi visible"></mi-mensaje>


                mi-mensaje {
  display: block;
  padding: 10px;
  border: 5px solid black;
mi-mensaje[casi-visible] {
  border: none;


                class MiMensaje extends HTMLElement {
  // propiedad para escuchar solo los atributos
  // definidos en el arreglo usando
  // attributeChangedCallback
  static get observedAttributes () {
    return ['msj', 'casi-visible'];
  //propieda 'msj' sincronizada con el atributo 'msj'
  get msj () {
    return this.getAttribute('msj');
  set msj (msj) {
    this.setAttribute('msj', msj);
  //propieda 'casiVisible' sincronizada con el atributo 'casi-visible'
  get casiVisible () {
    return this.hasAttribute('casi-visible');
  set casiVisible (value) {
    if(value) {
      this.setAttribute('casi-visible', '');  
    } else {
  // Pintar el mensaje que se declara en el atributo 'msj'
  pintarMensaje (msj) {
    this.innerHTML = msj
  // define la opacidad del elemento basado en la 
  // propiedad casiVisible
  setCasiVisible () {
    if(this.casiVisible) { = 0.1;
    } else { = 1;
  constructor () {
    this.addEventListener('click', function(e) {

  attributeChangedCallback (attrName, oldVal, newVal) {
    if(attrName === 'msj') {
    if(attrName === 'casi-visible') {

customElements.define('mi-mensaje', MiMensaje);