<div class="container">
  <p class="box">
    Sho&hyphen;rt words and specta&hyphen;cularly long words render the hard hyphen.
  </p>
  <p class="box">
    Only specta&shy;cularly long wor&shy;ds overflowing the box render the soft hyphen.
  </p>
</div>
.container {
  display: flex;
  width: 200px;
  justify-content: space-between;
}

.box {
  width: 50px;
  border: 1px solid;
  -webkit-hyphens: manual;
  -ms-hyphens: manual;
  hyphens: manual;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.