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

              
                <!-- /* Please ❤ this if you like it! 😊 */ -->

<!-- Page wrapper/Container Section -->
<div class="container">
	<!-- Responsive Table Section -->
	<table class="responsive-table">
		<!-- Responsive Table Header Section -->
		<thead class="responsive-table__head">
			<tr class="responsive-table__row">
				<th class="responsive-table__head__title responsive-table__head__title--name">Name</th>
				<th class="responsive-table__head__title responsive-table__head__title--status">Status</th>
				<th class="responsive-table__head__title responsive-table__head__title--types">Types</th>
				<th class="responsive-table__head__title responsive-table__head__title--update">Last updated at</th>
				<th class="responsive-table__head__title responsive-table__head__title--country">Country</th>
			</tr>
		</thead>
		<!-- Responsive Table Body Section -->
		<tbody class="responsive-table__body">
			<tr class="responsive-table__row">
				<td class="responsive-table__body__text responsive-table__body__text--name">
					<img class="user-icon" src="https://cdn-icons-png.flaticon.com/64/3135/3135715.png" alt="user" width="40" height="40" />
					Developer Zahid
				</td>
				<td class="responsive-table__body__text responsive-table__body__text--status"><span class="status-indicator status-indicator--active"></span>Active</td>
				<td class="responsive-table__body__text responsive-table__body__text--types">Attendee, F1</td>
				<td class="responsive-table__body__text responsive-table__body__text--update">Jul 17, 2021, 01:14 PM</td>
				<td class="responsive-table__body__text responsive-table__body__text--country">Bangladesh</td>
			</tr>
			<tr class="responsive-table__row">
				<td class="responsive-table__body__text responsive-table__body__text--name">
					<img class="user-icon" src="https://cdn-icons-png.flaticon.com/64/3135/3135715.png" alt="user" width="40" height="40" />
					John Doe
				</td>
				<td class="responsive-table__body__text responsive-table__body__text--status"><span class="status-indicator status-indicator--new"></span>New</td>
				<td class="responsive-table__body__text responsive-table__body__text--types">Attendee, F5</td>
				<td class="responsive-table__body__text responsive-table__body__text--update">Apr 24, 2021, 11:36 AM</td>
				<td class="responsive-table__body__text responsive-table__body__text--country">USA</td>
			</tr>
			<tr class="responsive-table__row">
				<td class="responsive-table__body__text responsive-table__body__text--name">
					<img class="user-icon" src="https://cdn-icons-png.flaticon.com/64/3135/3135715.png" alt="user" width="40" height="40" />
					Ryan Guill
				</td>
				<td class="responsive-table__body__text responsive-table__body__text--status"><span class="status-indicator status-indicator--inactive"></span>Inactive</td>
				<td class="responsive-table__body__text responsive-table__body__text--types">Attendee, MSR</td>
				<td class="responsive-table__body__text responsive-table__body__text--update">Aug 30, 2021, 05:54 PM</td>
				<td class="responsive-table__body__text responsive-table__body__text--country">Canada</td>
			</tr>
			<tr class="responsive-table__row">
				<td class="responsive-table__body__text responsive-table__body__text--name">
					<img class="user-icon" src="https://cdn-icons-png.flaticon.com/64/3135/3135715.png" alt="user" width="40" height="40" />
					Dan Broughan
				</td>
				<td class="responsive-table__body__text responsive-table__body__text--status"><span class="status-indicator status-indicator--active"></span>Active</td>
				<td class="responsive-table__body__text responsive-table__body__text--types">Attendee, Instructor, MSR</td>
				<td class="responsive-table__body__text responsive-table__body__text--update">Dec 15, 2021, 08:25 AM</td>
				<td class="responsive-table__body__text responsive-table__body__text--country">US</td>
			</tr>
		</tbody>
	</table>
</div>
              
            
!

CSS

              
                /* Please ❤ this if you like it! 😊 */

//SCSS Variables:
$bg-color: #f2f6f9;
$active-color: #25be64;
$inactive-color: #dadde4;
$new-color: #febf02;
$text-color: #141a4e;
$table-bg-color: #fefefe;
$table-head-bg-color: #e1e8f2;
$table-border-color: #edeef2;
$hover-bg-color: #fb4f83;
$hover-text-color: #ffffff;

//Responsive Breakpoint SCSS Mixin:

//xxs
@mixin mobile-xxs {
	@media (max-width: 400px) {
		@content;
	}
}
//min-sm
@mixin min-tablet {
	@media (min-width: 768px) {
		@content;
	}
}
//md
@mixin desktop {
	@media (max-width: 991px) {
		@content;
	}
}
//sm to md
@mixin tablet-to-desktop {
	@media (min-width: 768px) and (max-width: 991px) {
		@content;
	}
}

/* Googles Font Link */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap");

/* Reset Style */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

html {
	font-size: 10px;
}

body {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	font-family: "Poppins", sans-serif;
	color: $text-color;
	background-color: $bg-color;
	font-size: 1.6rem;
}

/* Page Wrapper/Container Style */
.container {
	width: 100%;
	max-width: 1140px;
	margin: 0 auto;
	padding: 0 15px;
}

/* Responsive Table Style */
.responsive-table {
	background-color: $table-bg-color;
	border-collapse: collapse;
	border-radius: 10px;
	box-shadow: 0 0 10px rgba($color: #000000, $alpha: 0.02);
	width: 100%;
	margin: 2rem 0;
	overflow: hidden;
	&__row {
		display: grid;
		border-bottom: 1px solid $table-border-color;
		padding: 0 1.5rem;
		@include min-tablet {
			grid-template-columns: 2fr 1fr 2fr 2fr 1fr;
		}
		@include tablet-to-desktop {
			grid-template-columns: 1fr 2fr 1fr;
		}
		th,
		td {
			padding: 1rem;
		}
	}
	&__head {
		background-color: $table-head-bg-color;
		@include desktop {
			display: none;
		}
		&__title {
			display: flex;
			align-items: center;
			font-weight: 500;
			text-transform: capitalize;
		}
	}
	&__body {
		.responsive-table__row {
			transition: 0.1s linear;
			transition-property: color, background;
			&:last-child {
				border-bottom: none;
			}
			&:hover {
				color: $hover-text-color;
				background-color: $hover-bg-color;
			}
		}
		&__text {
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			&::before {
				margin-right: 1rem;
				font-weight: 600;
				text-transform: capitalize;
			}
			@include desktop {
				&::before {
					content: attr(data-title) " :";
				}
			}
			@include mobile-xxs {
				&::before {
					width: 100%;
					margin-bottom: 1rem;
				}
			}
			&--name {
				font-weight: 600;
				@include min-tablet {
					&::before {
						display: none;
					}
				}
				@include tablet-to-desktop {
					grid-column: 1 / 2;
					flex-direction: column;
				}
			}
			&--status,
			&--types,
			&--update {
				@include tablet-to-desktop {
					grid-column: 2/ 3;
				}
			}
			&--country {
				@include tablet-to-desktop {
					grid-column: 3/ -1;
				}
			}
			&--name,
			&--country {
				@include tablet-to-desktop {
					grid-row: 2;
				}
			}
		}
	}
}

/* User Icon Style */
.user-icon {
	width: 4rem;
	max-width: 100%;
	margin-right: 1rem;
}

/* Status Indicator Style */
.status-indicator {
	display: inline-block;
	width: 1.8rem;
	height: 1.8rem;
	border-radius: 50%;
	background: #222222;
	margin-right: 0.5rem;
	&--active {
		background: $active-color;
	}
	&--inactive {
		background: $inactive-color;
	}
	&--new {
		background: $new-color;
	}
}

              
            
!

JS

              
                /* Please ❤ this if you like it! 😊 */

// Select thead titles from Dom
const headTitleName = document.querySelector(
	".responsive-table__head__title--name"
);
const headTitleStatus = document.querySelector(
	".responsive-table__head__title--status"
);
const headTitleTypes = document.querySelector(
	".responsive-table__head__title--types"
);
const headTitleUpdate = document.querySelector(
	".responsive-table__head__title--update"
);
const headTitleCountry = document.querySelector(
	".responsive-table__head__title--country"
);

// Select tbody text from Dom
const bodyTextName = document.querySelectorAll(
	".responsive-table__body__text--name"
);
const bodyTextStatus = document.querySelectorAll(
	".responsive-table__body__text--status"
);
const bodyTextTypes = document.querySelectorAll(
	".responsive-table__body__text--types"
);
const bodyTextUpdate = document.querySelectorAll(
	".responsive-table__body__text--update"
);
const bodyTextCountry = document.querySelectorAll(
	".responsive-table__body__text--country"
);

// Select all tbody table row from Dom
const totalTableBodyRow = document.querySelectorAll(
	".responsive-table__body .responsive-table__row"
);

// Get thead titles and append those into tbody table data items as a "data-title" attribute
for (let i = 0; i < totalTableBodyRow.length; i++) {
	bodyTextName[i].setAttribute("data-title", headTitleName.innerText);
	bodyTextStatus[i].setAttribute("data-title", headTitleStatus.innerText);
	bodyTextTypes[i].setAttribute("data-title", headTitleTypes.innerText);
	bodyTextUpdate[i].setAttribute("data-title", headTitleUpdate.innerText);
	bodyTextCountry[i].setAttribute("data-title", headTitleCountry.innerText);
}

              
            
!
999px

Console