<div class="wrapper">
 
  
  <div data-text></div>
  <span class="item">UI & UX designer</span>
  <span class="item">Webdesigner</span>
  <span class="item">Frontend developer</span>

  
 
</div>
.wrapper {
  padding: 10px;
  margin: 0 auto;
  width: 500px;
  text-align: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  .item {
    visibility: hidden;
    display: none;
  }

  h2 {
    font-size: 50px;
    margin: 0;
    color: #3a3a3a;
    text-align: left;
  }

  > div {
    min-height: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: flex-end;
    font-weight: bold;
    color: orange;

    &:after {
content: "";
    width: 10px;
    height: 4px;
    display: block;
    background: black;
    color: orange;
    margin-bottom: 4px;
    margin-left: 2px;
    animation-duration: 350ms;
    animation-name: fade;
    animation-direction: alternate;
    animation-iteration-count: infinite;
    }
  }
}

@keyframes fade {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}
View Compiled
let wrapper
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms))

async function writingAll (stringTarget, container){
  wrapper = document.querySelector('['+container+']')
  const stringsContainer = document.getElementsByClassName(stringTarget)
     
  while(wrapper){
    for (i=0; i <  stringsContainer.length ; i++){
      const string = stringsContainer[i].textContent
      await write(string)
      await sleep(1000)
      await erase()
      await sleep(1000)
    };
  }
};

async function write(text){    
  let index = 0
  while(index < text.length){
    const timeout = 100
    await sleep(timeout)
    index++
    wrapper.innerHTML = text.substring(0, index)
  }
};


async function erase() {
  while(wrapper.textContent.length){
    const timeout = 100
    await sleep(timeout)
    wrapper.textContent = wrapper.textContent.substring(0, wrapper.textContent.length - 2)
  }
};

writingAll('item', 'data-text');














View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.