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

              
                <div class="wrapper">
    <h2 class="test__title">hoverアニメーション対応【メディアクエリ】</h2>
    <div class="box" ontouchstart="">
        <div class="box-hover--media box-child">
            <h3 class="box-child__title">hoverを指定</h3>
            <div class="box-child-item">
                <a href="" class="link">aタグ文字リンク</a>
            </div>
            <div class="box-child-item">
                <button>buttonのボタン</button>
            </div>
            <div class="box-child-item">
                <div class="div-btn">divのボタン</div>
            </div>
            <div class="box-child-item">
                <img src="https://jito-site.com/wp-content/uploads/2022/12/test01.jpg" alt="" width="1280" height="843">
            </div>
        </div>
        <div class="box-active--media box-child">
            <h3 class="box-child__title">activeを指定</h3>
            <div class="box-child-item">
                <a href="" class="link">文字リンク</a>
            </div>
            <div class="box-child-item">
                <button>buttonのボタン</button>
            </div>
            <div class="box-child-item">
                <div class="div-btn">divタグのボタン</div>
            </div>
            <div class="box-child-item">
                <img src="https://jito-site.com/wp-content/uploads/2022/12/test01.jpg" alt="" width="1280" height="843">
            </div>
        </div>
    </div>
</div>
              
            
!

CSS

              
                .test__title {
  font-size: 30px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 20px;
  padding-top: .5em;
  padding-bottom: .5em;
  color: #fff;
  background-color: #000066;
}
@media screen and (max-width: 640px) {
  .test__title {
    font-size: 20px;
  }
}
.wrapper {
  max-width: 1000px;
  margin-top: 50px;
  margin-left: auto;
  margin-right: auto;
}
@media screen and (max-width: 1000px) {
  .wrapper {
    margin-right: 5%;
    margin-left: 5%;
  }
}
img {
  max-width: 100%;
  height: auto;
}

.box {
  display: flex;
  justify-content: space-between;
}
.box .box-child {
  width: 48%;
}
.box .box-child .box-child__title {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  color: #000066;
}
@media screen and (max-width: 640px) {
  .box .box-child .box-child__title {
    font-size: 16px;
  }
}
.box .box-child .box-child-item {
  padding: 20px;
  margin-top: 20px;
  background-color: #ececff;
}
@media screen and (max-width: 640px) {
  .box .box-child .box-child-item {
    padding: 10px;
  }
}
.box .box-child .link {
  display: inline-block;
  color: blue;
  transition: color .25s ease;
}
@media screen and (max-width: 640px) {
  .box .box-child .link {
    font-size: 12px;
  }
}
.box .box-child button {
  display: block;
  font-size: 20px;
  text-align: center;
  text-decoration: none;
  max-width: 100%;
  font-weight: 700;
  line-height: 1.6;
  padding: 1.2em 2em;
  margin-inline: auto;
  color: #fff;
  background-color: #ff8800;
  border-radius: 40px;
  cursor: pointer;
  transition: background-color .25s ease;
}
@media screen and (max-width: 640px) {
  .box .box-child button {
    font-size: 12px;
  }
}
.box .box-child .div-btn {
  display: block;
  font-size: 20px;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  line-height: 1.6;
  padding: 1.2em 0.5em;
  color: #fff;
  background-color: #ff8800;
  border-radius: 40px;
  cursor: pointer;
  transition: background-color .25s ease;
}
@media screen and (max-width: 640px) {
  .box .box-child .div-btn {
    font-size: 12px;
  }
}
.box .box-child img {
  cursor: pointer;
  transition: opacity .25s ease;
}

@media (hover: hover) {
  .box-hover--media .link:hover {
    color: red;
  }
  .box-hover--media button:hover {
    background-color: blue;
  }
  .box-hover--media .div-btn:hover {
    background-color: blue;
  }
  .box-hover--media img:hover {
    opacity: 0.1;
  }
}

@media (hover: none) {
  .box-active--media .link:active {
    color: red;
  }
  .box-active--media button:active {
    background-color: blue;
  }
  .box-active--media .div-btn:active {
    background-color: blue;
  }
  .box-active--media img:active {
    opacity: 0.1;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console