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

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                const socialIconsData = [
  {
    link: "https://github.com/sankovicivana",
    iconClass: "fab fa-github"
  } // ...
];

const topLinks = [
  {
    id: "tl-1",
    link:
      "https://miro.medium.com/v2/resize:fit:2434/1*qan3U0peL-CSdtKaCwKohA.png",
    title: "EXPLORE FRONTEND PATH"
  } // ...
];
const frontend = [
  {
    id: "f-1",
    link: "https://github.com/public-apis/public-apis",
    title: "FREE PUBLIC APIS"
  } // ...
];

const devops = [
  {
    id: "d-1",
    link:
      "https://www.freecodecamp.org/news/how-to-setup-a-ci-cd-pipeline-with-github-actions-and-aws/",
    title: "SETUP CI/CD PIPELINE WITH GITHUB ACTIONS AND AWS"
  }
];

const readingList = [
  {
    id: "rd-1",
    link:
      "https://www.freecodecamp.org/news/how-to-setup-a-ci-cd-pipeline-with-github-actions-and-aws/",
    title: "HOST FOR FREE ON GITHUB PAGES"
  }
];

function generateCards(
  cards,
  containerSelector,
  bgColorClass,
  headingTitle,
  headingSize = "text-2xl"
) {
  const container = document.querySelector(containerSelector);
  const cardsHTML = cards
    .map(
      (item) => `
    <div class="rounded-xl border border-solid border-gray-300 ${bgColorClass} hover:bg-pink-500 py-4 my-2 text-center cursor-pointer dark:border-gray-700 dark:bg-gray-800 dark:hover:bg-gray-700">
      <a href="${item.link}" target="_blank" class="text-indigo-900 hover:text-white text-sm md:text-base dark:text-gray-200 dark:hover:text-white">
        ${item.title}
      </a>
    </div>
  `
    )
    .join("");

  let sectionHTML = "";
  if (containerSelector === ".top-links-container") {
    sectionHTML = `
    <h1 class="md:text-4xl text-2xl font-bold text-blue-900 mb-4 dark:text-gray-200">
      ${headingTitle}
    </h1>
    <hr class="bg-gray-500 h-1 md:w-1/2 w-11/12 mx-auto mb-4" />
    ${cardsHTML}
  `;
  } else {
    sectionHTML = `
      <h2 class="text-2xl pt-8 mb-4 font-semibold text-blue-900 dark:text-gray-200">
        ${headingTitle}
      </h2>
      <hr class="bg-gray-500 h-1 w-9/12 mx-auto mb-6" />
      ${cardsHTML}
    `;
  }

  container.innerHTML = sectionHTML;
}

function generateSocialIcons() {
  const socialIconsContainer = document.querySelector(".social-icons");
  const socialIconsHTML = socialIconsData
    .map((item) => {
      return `
        <a href="${item.link}" target="_blank" class="text-pink-500 hover:text-blue-500 mx-2 dark:text-gray-400 dark:hover:text-gray-300">
          <i class="${item.iconClass}"></i>
        </a>
      `;
    })
    .join("");

  socialIconsContainer.innerHTML = socialIconsHTML;
}

(() => {
  generateSocialIcons();
  generateCards(
    topLinks,
    ".top-links-container",
    "bg-indigo-200",
    "Developer Resources Hub"
  );
  generateCards(
    frontend,
    ".frontend-cards-container",
    "bg-indigo-300",
    "Frontend Resources"
  );
  generateCards(
    devops,
    ".devops-cards-container",
    "bg-indigo-400",
    "DevOps Resources"
  );
  generateCards(
    readingList,
    ".reading-cards-container",
    "bg-indigo-300",
    "Add To Your Reading List"
  );
})();

              
            
!
999px

Console