cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + 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.

Quick-add: + add another resource

Code Indentation


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.

              <div class="wrapper">
  <h1>Highlight Within Textarea v2</h1>
  <p>Highlight <input type="text" id="blue-word" value="possible"> in blue and <input type="text" id="pink-word" value="magic"> in pink.</p>
  <textarea spellcheck="false">The two words above are highlighted in this textarea. Such a thing isn't actually possible with HTML, but we can fake it with some CSS and JS magic. Go ahead, type some stuff in here or change the words above to see the real-time highlighting in action.</textarea>

              @import url('https://fonts.googleapis.com/css?family=Asap:400,700');

*, *::before, *::after {
  box-sizing: border-box;

html {
  min-height: 100%;

body {
  margin: 0;
  font: 1.5rem 'Asap', sans-serif;
  background-image: linear-gradient(120deg, #9890e3 0%, #b1f4cf 100%);

.wrapper {
  width: 650px;
  margin: 40px auto;
  text-align: center;

h1 {
  margin: 0 0 20px;
  font-size: 2.75rem;
  text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.5);

p {
  margin: 0 0 40px;

input {
  appearance: none;
  display: inline-block;
  width: 100px;
  padding: 0;
  border: 0;
  border-bottom: 2px dashed #fff;
  border-radius: 0;
  text-align: center;
  font-size: inherit;
  font-family: inherit;
  font-weight: bold;
  background-color: transparent;

.hwt-container {
  background-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.2);

.hwt-content {
  width: 650px;
  height: 225px;
  padding: 20px;
  border: 1px solid #fff;
  text-align: left;
  font-size: 1.5rem;
  line-height: 1.5;
  mark {
    border-radius: 2px;
    background-color: #fcc2d7;
    box-shadow: 0 0 0 1px #fff;
    &.blue {
      background-color: #a3daff;
    &.pink {
      background-color: #fcc2d7;

              // Uses highlight-within-textarea
// https://github.com/lonekorean/highlight-within-textarea

function highlightBlue() {
  return $('#blue-word').val();

function highlightPink() {
  return $('#pink-word').val();

function updateHighlights() {

  highlight: [
      highlight: highlightBlue,
      className: 'blue'
      highlight: highlightPink,
      className: 'pink'

$('input').on('input', updateHighlights);

Loading ..................