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

              
                <header>
  <h1 class="yukio"><a href="index.html"><img src="https://placehold.jp/100x50.png?text=ロゴ" alt="ロゴ"></a>
    <img class="hamburger" id="open_nav" src="https://placehold.jp/100x50.png?text=ロゴ" alt="ロゴ">
  </h1>
  <div id="slide">
    <ul>
      <li><img class="sun" src="https://picsum.photos/seed/a/800/146" alt="画像1" width="800" height="146">
      </li>
      <li><img class="sun" src="https://picsum.photos/seed/b/800/146" alt="画像2" width="800" height="146">
      </li>
      <li><img class="sun" src="https://picsum.photos/seed/c/800/146" alt="画像3" width="800" height="146">
      </li>
    </ul>
  </div>
</header>
<main>
  <h2>main</h2>
  <a href="https://teratail.com/questions/330187">HTML - レスポンシブルに対応してサイズ比を変えずに画像の横幅を縮小したい|teratail</a>
</main>
              
            
!

CSS

              
                #slide {
  max-width:800px;
  margin:0 auto;
  position:relative;
}

#slide ul  {
  width:100%;
  padding-top: 17.25%;
}

#slide img {
  width: 100%; 
  height: auto;
}

@media screen and (max-width: 768px) {
  #slide {
    width: 100%;
  }
}
              
            
!

JS

              
                $(function(){
  // 設定
  var $interval = 8000; // 切り替わりの間隔(ミリ秒)
  var $fade_speed = 3000; // フェード処理の早さ(ミリ秒)
  $("#slide ul li").css({"position":"relative","overflow":"hidden"});
  $("#slide ul li").hide().css({"position":"absolute","top":0,"left":0});
  $("#slide ul li:first").addClass("active").show();
  setInterval(function(){
    var $active = $("#slide ul li.active");
    var $next = $active.next("li").length?$active.next("li"):$("#slide ul li:first");
    $active.fadeOut($fade_speed).removeClass("active");
    $next.fadeIn($fade_speed).addClass("active");
  },$interval);
});
              
            
!
999px

Console