Pen Settings

HTML

CSS

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.

+ 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

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.

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

              
                <!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <link rel="stylesheet" href="style.css" />
    <title>Document</title>
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css"
      integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ="
      crossorigin="anonymous"
    />
    <script type="text/javascript" src="jquery-3.4.1.min.js"></script>
  </head>
  <body>
    <div class="header">
      <h1>
        Basic Contents Slider<br />
        using jQuery
      </h1>
    </div>
    <div class="slider">
      <ul class="slides">
        <li class="slide">
          <div class="content">
            <div class="imgBox">
              <i class="fab fa-html5"></i>
            </div>
            <h2>HTML</h2>
            <p>
              stands for Hyper Text Markup Language.<br />
              HTML is the standard markup language for Web pages.<br />
              elements are the building blocks of HTML pages.
            </p>
          </div>
        </li>
        <li class="slide">
          <div class="content">
            <div class="imgBox">
              <i class="fab fa-css3"></i>
            </div>
            <h2>CSS</h2>
            <p>
              CSS describes how HTML elements are to be displayed on screen,
              paper, or in other media CSS saves a lot of work. <br />It can
              control the layout of multiple web pages all at once
            </p>
          </div>
        </li>
        <li class="slide">
          <div class="content">
            <div class="imgBox">
              <i class="fab fa-js-square"></i>
            </div>
            <h2>JavaScript</h2>
            <p>
              JavaScript is the Programming Language for the Web.
              <br />
              can update and change both HTML and CSS. <br />
              can calculate, manipulate and validate data.
            </p>
          </div>
        </li>
      </ul>
      <ul class="foo">
        <li>
          <span id="active"></span>
        </li>
        <li>
          <span></span>
        </li>
        <li>
          <span></span>
        </li>
      </ul>
    </div>
    <script src="main.js"></script>
  </body>
</html>

              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css?family=Open+Sans:700,800&display=swap");

body {
  padding: 0;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

h1 {
  font-family: "Open Sans", sans-serif;
  font-weight: 800;
  font-size: 35px;
  color: white;
  margin: 13px 30px;
  letter-spacing: 2px;
}

.header {
  text-align: center;
}
.slider {
  position: relative;
  width: 380px;
  height: 420px;
  margin: 0 auto;
  overflow: hidden;
  background-color: white;
  border-radius: 6px;
  box-shadow: 0 10px 20px 5px rgb(0, 0, 0, 0.4);
}

.slides {
  display: block;
  width: 2000px;
  height: 420px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.slide {
  float: left;
  height: 420px;
  width: 380px;
}
.content {
  text-align: center;
  margin: 50px 20px;
  padding: 20px 5px;
  border-top: 2px solid rgb(145, 100, 255);
  border-bottom: 2px solid rgb(145, 100, 255);
}

.imgBox {
  display: block;
  position: relative;
  width: 75px;
  height: 75px;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  background-color: rgb(110, 65, 235);
  border: 5px solid rgb(145, 100, 255);
}

i {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translateX(-50%) translateY(-50%);
  color: white;
  font-size: 45px;
}

h2 {
  position: relative;
  font-family: "Open Sans", sans-serif;
  font-weight: 800;
  font-size: 30px;
  color: #111111;
  margin: 5px 0px 20px 0px;
}

h2::before {
  position: absolute;
  content: "";
  width: 36px;
  height: 5px;
  top: 120%;
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  background-color: rgb(110, 65, 235);
  border-radius: 5px;
}

p {
  font-family: "Open Sans", sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: #0e0e0e;
  line-height: 1.4rem;
  margin: 13px 0px;
}

ul.foo {
  width: 380px;
  text-align: center;
  list-style: none;
  padding: 0;
  font-size: 0;
  position: absolute;
  top: 97%;
  left: 50%;
  transform: translateX(-50%) translateY(-97%);
}

ul.foo li {
  display: inline-block;
  width: 12px;
  height: 12px;
  text-align: center;
  padding: 8px;
}

ul.foo li span {
  display: block;
  width: 10px;
  height: 10px;
  background-color: rgb(180, 150, 255);
  border-radius: 50%;
}

#active {
  background-color: rgb(110, 65, 235);
}

              
            
!

JS

              
                $("document").ready(function(){
  var currentSlide = 1;
  var $slider = $(".slides");
  var slideCount = $slider.children().length;

  setInterval(function() {
    $slider.animate(
      {
        marginLeft: "-=380px"
      },
      800,
      function() {
        currentSlide++;
        if (currentSlide > slideCount) {
          $(this).animate({ marginLeft: 0 });
          $("span")
            .eq(0)
            .attr("id", "active");
          $("span")
            .eq(2)
            .removeAttr("id", "active");
          currentSlide = 1;
        } else if (currentSlide === 2) {
          $("span")
            .eq(0)
            .removeAttr("id", "active");
          $("span")
            .eq(1)
            .attr("id", "active");
        } else if (currentSlide === 3) {
          $("span")
            .eq(1)
            .removeAttr("id", "active");
          $("span")
            .eq(2)
            .attr("id", "active");
        }
      }
    );
  }, 6000);
});

              
            
!
999px

Console