Pen Settings



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


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


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.


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.


  <a href="#main-content" class="skip-link">Skip to Content</a>
  <div class="header-content">
    <p class="site-title">Example Site</p>
        <li><a href="#welcome">Test Smooth Scroll</a></li>
        <li><a href="">Home</a></li>
        <li><a href="">About</a></li>
        <li><a href="">Accessibility Checker</a></li>
        <li><a href="">Contact</a></li>

<main id="main-content" class="main">

  <h1 id="welcome">Welcome to Our Website</h1>
  <p>This is the main content of the page. We put it really far down just to see how smooth scroll works.</p>
  <p>Here is a link to the <a href="">Equalize Digital website</a> just to have another focusable element on the page within the main tag.</p>


                /* Hide the skip link visually */
.skip-link {
  position: absolute;
  left: -9999px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none; /* Disable mouse events */

/* Show the skip link when it receives keyboard focus */
.skip-link:focus {
  position: static; /* Return to the normal flow */
  opacity: 1;
  background: #fff;
  padding: 10px;
  left: auto;
  pointer-events: auto; /* Enable mouse events */

/* Header styling */
.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #333;
  padding: 40px 20px;

header .site-title {
  font-size: 2em;
  color: #eee;
  font-weight: 700;
  float: left;

/* Navigation styling */
nav ul {
  list-style: none; /* Remove bullets */
  padding: 0;
  margin: 0;

nav ul li {
  display: inline-block;
  margin-right: 20px;

nav ul li a {
  text-decoration: none;
  color: #fff;
  font-weight: bold;

nav ul li a:hover {
  text-decoration: underline;

/* Main Content styling */

.main {
  background: #f3f4fd;
  padding: 300px 20px;
  text-align: center;

/* CSS for smooth scrolling */
html {
  scroll-behavior: smooth;

/* Media Query for screens narrower than 500px */
@media screen and (max-width: 600px) {
  .header-content {
    display: flex;
    flex-direction: column; /* Stack elements vertically on small screens */
    justify-content: left;
    align-items: center;

  .site-title {
    font-size: 1.2em;
    width: 80%;

  nav {
    width: 80%;

  nav ul li {
    display: block;
    margin: 10px 0;



                // Function to handle smooth scrolling and focus shifting
function smoothScrollToTarget(targetId) {
  const targetElement = document.getElementById(targetId);

  if (targetElement) {
      behavior: "smooth",
      block: "start" // Scroll to the top of the element

    targetElement.setAttribute("tabindex", "-1"); // Make the target element focusable
    targetElement.focus(); // Shift keyboard focus to the target element
    targetElement.removeAttribute("tabindex"); // Remove tabindex after focus

// Event listener for smooth scrolling when clicking links
document.addEventListener("click", (event) => {
  if ( === "A" &&"href").startsWith("#")
  ) {
    event.preventDefault(); // Prevent the default link behavior

    const targetId ="href").substring(1); // Remove the '#' character