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

              
                <body>
  <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>
  <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick-theme.css"/>
  <header class="header">
    <div class="content-wrapper header-nav">
      <h1>XX株式会社</h1>
      <!-- navメニューについては、今回は割愛 -->
      <!-- <nav>
        <ul>
          <li><a href="#">トップページ</a></li>
          <li><a href="#">会社概要</a></li>
          <li><a href="#">事業内容</a></li>
          <li><a href="#">採用情報</a></li>
          <li><a href="#">お問い合わせ</a></li>
        </ul>
      </nav> -->
    </div>
  </header>
  <section class="mainvisual">
    <img src="https://images.unsplash.com/photo-1606501126768-b78d4569d3f9?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=870&q=80" alt="金属加工作業">
    <h2>ものづくりが好き</h2>
    <div class="bg1"></div>   
  </section>
  
  <script src="https://code.jquery.com/jquery-3.6.1.min.js"></script>
</body>
              
            
!

CSS

              
                @charset "UTF-8";

body {
  margin: 0;
  padding: 0;
  font-family: "Yu Gothic", "游ゴシック", YuGothic, "游ゴシック体", sans-serif;
  font-weight: 500;
  color: #333;
  line-height: 2.0;
}
h1 {
  font-size: 2rem;
  color: #ffffff;
}
h2,h3,h4,h5 {
  margin: 0;
  padding: 0;
}

img {
  width: 100%;
  vertical-align: bottom;
}

a { 
  text-decoration: none;
  color: #000;
}

a:hover { 
  transition: .3s;
  opacity: 0.6;
}

section {
  margin-bottom: 120px;
}

.content-wrapper {
  max-width: 1400px; /* 画面サイズで可変するように"max-"を追加 */
  padding: 0 20px; /* 左右に余白を作る */
  margin: 0 auto;
}

/* ---------
  header 
------------*/
.header-nav {
  height: 100px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* navメニューについては、今回は割愛 */
/* .header nav ul {
  display: flex;
  justify-content: space-between;
  align-items: center;
} */

/* .header nav ul li {
  margin-right: 50px;
} */

/* ---------
  mainvisual 
------------*/

.mainvisual {
  position: relative;
  height: 600px;
}

.mainvisual img {
  width: 70%;
  height: 500px;
  object-fit: cover;
  margin-left: 30%;
}

.mainvisual h2 {
  position: absolute;
  top: 30%;
  left: 20%;
  background: rgba(255, 255, 255, 0.6);
  font-size: 3rem;
  padding: 1rem;
}

.mainvisual::before {
  position: absolute;
  content: "";
  background: #333;
  height: 700px;
  width: 45%;
  top: -18%;
  left: 0;
  z-index: -1;
}

/* 空タグは使わず、擬似要素で実装 */
/* .bg1 {
  background: #e8e7e7;
  height: 700px;
  width: 45%;
  position: absolute;
  top: -18%;
  left: 0;
  z-index: -1;
} */
              
            
!

JS

              
                
              
            
!
999px

Console