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

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

              
                <header>
  <a href="#" class="logo">Food<span>.</span>v</a>
  <ul class="navigation">
    <li><a href="#banner">Home</a></li>
    <li><a href="#about">About</a></li>
    <li><a href="#menu">Menu</a></li>
    <li><a href="#expert">Expert</a></li>
    <li><a href="#testimonials">Testimonials</a></li>
    <li><a href="#contact">Contact</a></li>
  </ul>

  <div class="burger">
    <div class="line1"></div>
    <div class="line2"></div>
    <div class="line3"></div>
  </div>
</header>

<section class="contact" id="contact">
  <div class="title">
    <h2 class="titleText"><span>C</span>contact Us</h2>
    <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
  </div>
  <div class="contactForm">
    <h3>Send Message</h3>

    <div class="inputBox">
      <input type="text" placeholder="Name">
    </div>
    <div class="inputBox">
      <input type="text" placeholder="Email">
    </div>
    <div class="inputBox">
      <textarea placeholder="Name"></textarea>
    </div>
    <div class="inputBox">
      <input type="submit" value="Send">
    </div>

  </div>
</section>

<div class="copyrightText">
  <p>Copyright 2021 <a href="#">Online Tutorials</a>.All right Reserved</p>
</div>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css?family=Poppins:200,300,400,500,600,700,800,900&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
  scroll-behavior: smooth;
}

p {
  font-weight: 300;
  color: #111;
}

/* body
{
  min-height: 1000px;
} */

.banner {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  /* background-image: url("0.jpg"); */
  background-color: rgb(212, 205, 107);

  background-size: cover;
}

.banner .content {
  max-width: 900px;
  text-align: center;
}

.banner .content h2 {
  font-size: 4em;
  color: #fff;
}

.banner .content p {
  font-size: 1em;
  /* color: #fff; */
}

.btn {
  font-size: 1em;
  color: #fff;
  background: #ff0157;
  display: inline-block;
  padding: 10px 30px;
  margin-top: 20px;
  text-transform: uppercase;
  text-decoration: none;
  letter-spacing: 2px;
  transition: 0.5s;
}

.btn:hover {
  letter-spacing: 6px;
}

header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 40px 100px;
  z-index: 10000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: 0.5s;
}

header.sticky {
  background: #fff;
  padding: 10px 100px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

header .logo {
  color: #fff;
  font-weight: 700;
  font-size: 2em;
  text-decoration: none;
}

header.sticky .logo {
  color: #111;
}

header .logo span {
  color: #ff0157;
}

header .navigation {
  position: relative;
  display: flex;
  /* background-color: pink; */
  justify-content: space-around;
}

header .navigation li {
  list-style: none;
  margin-left: 30px;
}

header .navigation li a {
  text-decoration: none;
  color: #fff;
  font-weight: 300;
}

header.sticky .navigation li a {
  color: #111;
}

header .navigation li a:hover {
  color: #ff0157;
}

section {
  padding: 100px;
}

.row {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: space-between;
}

.row .col50 {
  position: relative;
  width: 48%;
}

.titleText {
  color: #111;
  font-size: 2em;
  font-weight: 300;
}

.titleText span {
  color: #ff0157;
  font-weight: 700;
  font-size: 1.5em;
}

.row .col50 .imgBx {
  position: relative;
  width: 100%;
  /* min-height: 300px; */
  height: 100%;
}

.row .col50 .imgBx img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.title {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.menu .content {
  display: flex;
  justify-content: center;
  flex-direction: row-reverse;
  flex-wrap: wrap;
  margin-top: 40px;
}

.menu .content .box {
  width: 340px;
  margin: 20px;
  border: 15px solid #fff;
  box-shadow: 0 5px 35px rgba(0, 0, 0, 0.08);
}

.menu .content .box .imgBx {
  position: relative;
  width: 100%;
  height: 300px;
}

.menu .content .box .imgBx img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.menu .content .box .text {
  padding: 15px 0 5px;
}

.menu .content .box .text h3 {
  font-weight: 400;
  color: #111;
}

.expert .content {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  flex-direction: row;
  margin-top: 40px;
}

.expert .content .box {
  width: 250px;
  margin: 15px;
}

.expert .content .box .imgBx {
  position: relative;
  width: 100%;
  height: 300px;
}

.expert .content .box .imgBx img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.expert .content .box .text {
  padding: 15px 0 5px;
}

.expert .content .box .text h3 {
  font-weight: 400;
  color: #111;
}

.testimonials {
  background: url(co01.jpg);
  background-size: cover;
}

.white .titleText,
.white p {
  color: #fff;
}

.testimonials .content {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  flex-direction: row;
  margin-top: 40px;
}

.testimonials .content .box {
  width: 340px;
  margin: 20px;
  padding: 40px;
  background: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.testimonials .content .box .imgBx {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  border-radius: 50%;
  overflow: hidden;
}

.testimonials .content .box .imgBx img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.testimonials .content .box .text {
  text-align: center;
}

.testimonials .content .box .text p {
  color: #666;
  font-style: italic;
}

.testimonials .content .box .text h3 {
  margin-top: 20px;
  color: #111;
  font-size: 1em;
  color: #ff0157;
  font-weight: 600;
}

.contact {
  background: url(img15.jpg);
  background-size: cover;
}

.contactForm {
  position: relative;
  left: -50px;
  padding: 75px 50px;
  background: #fff;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.1);
  max-width: 500px;
  margin-top: 50px;
}

.contactForm h3 {
  color: #111;
  font-size: 1.2em;
  margin-bottom: 20px;
  font-weight: 500;
}

.contactForm .inputBox {
  position: relative;
  width: 100%;
  margin-bottom: 20px;
}

.contactForm .inputBox input,
.contactForm .inputBox textarea {
  width: 100%;
  border: 1px sold #555;
  padding: 10px;
  color: #111;
  outline: none;
  font-size: 16px;
  font-weight: 300;
  resize: none;
}

.contactForm .inputBox input[type="submit"] {
  font-size: 1em;
  color: #fff;
  background: #ff0157;
  display: inline-block;
  text-transform: uppercase;
  text-decoration: none;
  letter-spacing: 2px;
  transition: 0.5s;
  max-width: 100px;
  font-weight: 500;
  border: none;
  cursor: pointer;

  box-shadow: 0 5px #970707;
}

.copyrightText {
  padding: 8px 40px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  text-align: center;
}

.copyrightText p {
  color: #ff0157;
  font-weight: 500;
  text-decoration: none;
}

.contactForm .inputBox input[type="submit"]:active {
  box-shadow: none;
  position: relative;
  top: 5px;
}

/* ====================== */
.burger{
  cursor: pointer;
  display: none;
}
 .burger div {
  width: 25px;
  height: 3px;
  background-color: rgb(161, 12, 12);
  margin: 5px;
}

.navigation-active {
  transform: translateX(0%)!important;
}

/* 以下追加 */
.navigation + .burger > div {
  transition: 0.5s;
}

.navigation-active + .burger > .line2 {
  opacity: 0;
}
.navigation-active + .burger > .line1 {
  transform: translatey(8px) rotate(45deg);
}
.navigation-active + .burger > .line3 {
  transform:  translatey(-8px) rotate(-45deg);
}
/* ここまで */

@media screen and (max-width: 1024px) {
.navigation {
    width: 75%;
  }
}


@media screen and (max-width: 768px) {
  body {
    overflow-x: hidden;
  }
    ul.navigation  { /* 修正 */
    position: absolute;
    right: 0;
    height: 92vh;
    top: 8vh;
    background-color: rgb(133, 133, 210);
    flex-direction: column;
    align-items: center;
    width: 50%;
    transform: translateX(100%);
    transition: 0.5s; /* 追加 */
  }
  header.sticky ul.navigation li a { /* 修正 */
    color: rgb(232, 209, 209);
  }

  .burger {
    display: block;
  }

    /*  .navigation li {
  opacity: 0; 
  } */
} 
              
            
!

JS

              
                window.addEventListener("scroll", function () {
  const header = document.querySelector("header");
  header.classList.toggle("sticky", window.scrollY > 0);
});
const burger = document.querySelector(".burger")
const navigation = document.querySelector(".navigation")

burger.addEventListener("click", () =>  {
    navigation.classList.toggle("navigation-active");
});
              
            
!
999px

Console