Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Auto Save

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.

HTML

              
                <div id="right_panel">
  <div class="wrap-table">
    <table>
      <thead>
        <tr>
          <th scope="col" class="sticky-col">Customer</th>
          <th scope="col">Status</th>
          <th scope="col">Course</th>
          <th scope="col">Enrolled</th>
          <th scope="col">Progress</th>
          <th scope="col">Date</th>
          <th scope="col" class="sticky-col sticky-col-right">Actions</th>
        </tr>
      </thead>
      
      <tbody>
        <tr>
          <td class="sticky-col" scope="row" data-label="Customer">
            <div class="user__info">
              <label>
                <input type="checkbox">
                <span>
                  <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-6 h-6">
  <path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5" />
</svg>
</span>
              </label>
               <img class="user__photo" src="https://images.unsplash.com/photo-1517841905240-472988babdf9?ixlib=rb-1.2.1&amp;ixid=eyJhcHBfaWQiOjEyMDd9&amp;auto=format&amp;fit=facearea&amp;facepad=2&amp;w=256&amp;h=256&amp;q=80" alt="">
              <div>
                <div class="user__name">Lindsay Walton</div>
                <div class="user__email">lindsay@example.com</div>
              </div>
            </div>
          </td>
          <td data-label="Status">
            <div class="user__badge">Enrolled</div>
          </td>
          <td data-label="Course">
            <span>HTML</span>
          </td>
          <td data-label="Enrolled">Member</td>
          <td data-label="Progress">
            <progress value="32" max="100"> 32% </progress>
          </td>
          <td data-label="Date">9/08/2023</td>
          <td data-label="Actions" class="sticky-col sticky-col-right">
            <a href="#" class="user__edit">Edit</a>
            </td>
            </tr>
        <tr>
          <td class="sticky-col" scope="row" data-label="Customer">
            <div class="user__info">
              <label>
                <input type="checkbox">
                <span>
                  <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-6 h-6">
  <path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5" />
</svg>
</span>
              </label>
               <img class="user__photo" src="https://t4.ftcdn.net/jpg/02/14/74/61/360_F_214746128_31JkeaP6rU0NzzzdFC4khGkmqc8noe6h.jpg" alt="">
              <div>
                <div class="user__name">Marvin McKinney</div>
                <div class="user__email">marvin@example.com</div>
              </div>
            </div>
          </td>
          <td data-label="Status">
            <div class="user__badge">Enrolled</div>
          </td>
          <td data-label="Course">
            <span>CSS</span>
          </td>
          <td data-label="Enrolled">Member</td>
          <td data-label="Progress">
            <progress value="56" max="100"> 56% </progress>
          </td>
          <td data-label="Date">3/13/2023</td>
          <td data-label="Actions" class="sticky-col sticky-col-right">
            <a href="#" class="user__edit">Edit</a>
            </td>
            </tr>
        <tr>
          <td class="sticky-col" scope="row" data-label="Customer">
            <div class="user__info">
              <label>
                <input type="checkbox">
                <span>
                  <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-6 h-6">
  <path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5" />
</svg>
</span>
              </label>
               <img class="user__photo" src="https://img.freepik.com/free-photo/female-looking-directly-into-camera_273609-12389.jpg?t=st=1698951187~exp=1698951787~hmac=56a4af748044a4b82323def79882a55ac39f150aea6e1738cba45a52f3e9563a" alt="">
              <div>
                <div class="user__name">Alma Lawson</div>
                <div class="user__email">alma@example.com</div>
              </div>
            </div>
          </td>
          <td data-label="Status">
            <div class="user__badge user__badge_unpaid">Not paid</div>
          </td>
          <td data-label="Course">
            <span>Ruby on Rails</span>
          </td>
          <td data-label="Enrolled">Member</td>
          <td data-label="Progress">
            <progress value="12" max="100"> 12% </progress>
          </td>
          <td data-label="Date">10/02/2023</td>
          <td data-label="Actions" class="sticky-col sticky-col-right">
            <a href="#" class="user__edit">Edit</a>
            </td>
            </tr>
        <tr>
          <td class="sticky-col" scope="row" data-label="Customer">
            <div class="user__info">
              <label>
                <input type="checkbox">
                <span>
                  <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-6 h-6">
  <path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5" />
</svg>
</span>
              </label>
               <img class="user__photo" src="https://as2.ftcdn.net/v2/jpg/02/24/86/95/1000_F_224869519_aRaeLneqALfPNBzg0xxMZXghtvBXkfIA.jpg" alt="">
              <div>
                <div class="user__name">Floyd Miles</div>
                <div class="user__email">floyd@example.com</div>
              </div>
            </div>
          </td>
          <td data-label="Status">
            <div class="user__badge">Enrolled</div>
          </td>
          <td data-label="Course">
            <span>CSS</span>
          </td>
          <td data-label="Enrolled">Member</td>
          <td data-label="Progress">
            <progress value="100" max="100"> 100% </progress>
          </td>
          <td data-label="Date">6/12/2023</td>
          <td data-label="Actions" class="sticky-col sticky-col-right">
            <a href="#" class="user__edit">Edit</a>
            </td>
            </tr>
        <tr>
          <td class="sticky-col" scope="row" data-label="Customer">
            <div class="user__info">
              <label>
                <input type="checkbox">
                <span>
                  <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-6 h-6">
  <path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5" />
</svg>
</span>
              </label>
               <img class="user__photo" src="https://img.freepik.com/free-photo/pretty-smiling-joyfully-female-with-fair-hair-dressed-casually-looking-with-satisfaction_176420-15187.jpg?t=st=1698950906~exp=1698951506~hmac=d7a71b36eec872667dc27ea767679dc74adf02bff3acb18a1b1523b63843fdfa" alt="">
              <div>
                <div class="user__name">Georgia Young</div>
                <div class="user__email">georgia@example.com</div>
              </div>
            </div>
          </td>
          <td data-label="Status">
            <div class="user__badge user__badge_pending">Pending</div>
          </td>
          <td data-label="Course">
            <span>JavaScript</span>
          </td>
          <td data-label="Enrolled">Member</td>
          <td data-label="Progress">
            <progress value="10" max="100"> 10% </progress>
          </td>
          <td data-label="Date">9/29/2023</td>
          <td data-label="Actions" class="sticky-col sticky-col-right">
            <a href="#" class="user__edit">Edit</a>
            </td>
            </tr>
      </tbody>
    </table>
  </div>
  <button id="btn_resize">
    <span></span>
  </button>
</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100;400;500;600&display=swap');

body {
  font-family: 'Poppins', sans-serif;
  display: flex;
  justify-content: center;
  padding: 40px 0;
  color: #111827;
}

.wrap-table {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow-x: auto;
  width: 100%;
  container-type: inline-size;
  container-name: table;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

th {
  font-weight: 700;
  color: #374151;
  font-size: 14px;
  padding: 12px 14px;
  text-align: left;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.user__photo {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 100px;
}

.user__info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user__name {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.user__email {
  font-size: 12px;
  color: #4b5563;
}

.user__badge {
  width: max-content;
  background: #dcfce7;
  border-radius: 6px;
  border: 1px solid #15803d;
  color: #15803d;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
}

.user__badge:before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 100px;
  background: #15803d;
  display: block;
}

.user__badge_pending {
  background: #fefce8;
  color: #8a551c;
  border-color: #f4e7c5;
}

.user__badge_pending:before {
  background: #8a551c;
}

.user__badge_unpaid {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fbe0e0;
}

.user__badge_unpaid:before {
  background: #b91c1c;
}

.user__edit {
  display: block;
  padding: 4px 12px;
  text-decoration: none;
}

input {
  display: none;
}

input + span {
  display: block;
  width: 16px;
  height: 16px;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  transition: .3s;
  cursor: pointer;
}

input + span > svg {
  opacity: 0;
}

input:checked + span {
  background: #dcfce7;
  border: 2px solid #15803d;
  color: #15803d;
}

input:checked + span > svg {
  opacity: 1;
}

progress {
  display: block;
  width: 100px;
  height: 7px;
  -webkit-appearance: none;
  border-radius: 10px;
}

progress::-webkit-progress-bar {
  background-color: #eee;
  border-radius: 10px;
}

progress::-webkit-progress-value {
  background-color: #10b981;
  border-radius: 10px;
}

.user__edit {
  padding: 8px 12px;
  border-radius: 6px;
  background: #6366f1;
  color: #fff;
  text-align: center;
  font-weight: 500;
}

@container table (min-width: 400px) {
    .sticky-col {
     position: sticky;
     left: 0;
  }
  
  .sticky-col-right {
    right: 0;
  }
}

@container table (max-width: 400px) {
  td::before {
      content: attr(data-label);
      font-weight: 700;
      color: #374151;
      font-size: 14px;  
  }
  
  label {
    display: none;
  }
  
  td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: none;
  }
  
  td:first-child {
    background: #f9fafb;
  }
  
  th {
    display: none;
  }
}









#right_panel {
  width: 1000px;
  position:relative;
}

#btn_resize {
  cursor: ew-resize;
  width: 14px;
  height: 100%;
  position: absolute;
  top:0;
  left: calc(100% + 3px);
  background: #fff;
  display: flex;
  align-items: start;
  justify-content: center;
  border: none;
  padding: 0;
}

#btn_resize span {
  background: #94a3b8;
  height: 32px;
  width: 4px;
  display: block;
  border-radius: 10px;
}
              
            
!

JS

              
                const BORDER_SIZE = 14;
const panel = document.getElementById("right_panel");

let m_pos;
function resize(e){
  const dx = m_pos - e.x;
  m_pos = e.x;
  panel.style.width = (parseInt(getComputedStyle(panel, '').width) - dx) + "px";
}

panel.addEventListener("mousedown", function(e){
  if (e.offsetX < BORDER_SIZE) {
    m_pos = e.x;
    document.addEventListener("mousemove", resize, false);
  }
}, false);

document.addEventListener("mouseup", function(){
    document.removeEventListener("mousemove", resize, false);
}, false);
              
            
!
999px

Console