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

              
                <html>

<head>
  <meta charset="utf-8">
  <title>AIRPODS MAX</title>

  <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet">
</head>

<body>

  <div class="wrapper">
    <div id="bag__cart" style="display:flex;align-items:center;justify-content: space-around;padding:19px;width: 300px; height: 100px; background-color: #1d1d1f; position: absolute; right: 10px; border-radius: 0px 0px 15px 15px;box-shadow: 5px 5px 30px 5px #1d1d1fd9;text-align:center;"><img src="https://www.apple.com/ac/globalnav/6/ru_RU/images/be15095f-5a20-57d0-ad14-cf4c638e223a/globalnav_bag_image__bmix8075eg4i_small.svg" style="width:36px;height:auto;">
      <div class="bag__title" style="color:white;">1 x AIRPODS MAX</div>
      <div id="bag__delete" style="color:white;font-size:30px;border:0.4px solid white;padding:0px 5px;;border-radius:10%;">-</div>
      <div id="bag__add" style="color:white;font-size:30px;border:0.4px solid white;padding:0px 5px;border-radius:10%;">+</div>
    </div>
    <div class="card">
      <div class="card__header card__header__airpodsmax">
        <div class="card__watermark"></div>

        <img src="https://upload.wikimedia.org/wikipedia/commons/3/31/Apple_logo_white.svg" alt="AIRPODS MAX" class="card__logo">

        <span class="card__price">$600</span>

        <h1 class="card__title">AirPods Max</h1>
        <span class="card__subtitle">Представляем наушники AirPods Max, где высочайшее качество звука в полной гармонии с волшебной простотой AirPods. Это звук в блестящем исполнении.</span>

      </div>

      <div class="card__body">
        <img src="https://www.dimprice.co.uk/image/cache/png/apple-airpods-max/blue/apple-airpods-max-blue-01-800x800.png" alt="AIRPODS_MAX" class="card__image">
        <div class="card__buy card__buy__airpodsmax" id="logo">Купить</div>

        <span class="card__buy__subtitle">Элегантный дизайн и полный комфорт</span>
      </div>
    </div>

  </div>
  <div>Все права на изображения и текст принадлежат <a href="https://www.apple.com/">https://www.apple.com/</a> и использованы здесь в обучающих целях</div>
</body>

</html>
              
            
!

CSS

              
                html,
body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;

  font-family: "Roboto", "Helvetica", sans-serif;

  background: linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.15) 0%,
      rgba(0, 0, 0, 0.15) 100%
    ),
    radial-gradient(
        at top center,
        rgba(255, 255, 255, 0.4) 0%,
        rgba(0, 0, 0, 0.4) 120%
      )
      #989898;
  background-blend-mode: multiply, multiply;
  color: #1d1d1f;
}

.wrapper {
  position: relative;
  overflow-x: hidden;
  width: 100%;
  height: 100%;
  display: flex;

  justify-content: center;
}

.card {
  display: block;
  position: absolute;
  top: 25px;
  margin: 0 auto;
  width: 350px;
  background-color: #1d1d1f;
  border-radius: 15px;

  box-shadow: 5px 5px 30px 5px #1d1d1fd9;
}

.card__header {
  position: relative;
  height: 170px;
  padding: 30px 30px 260px;
  border-top-right-radius: 15px;
  border-top-left-radius: 15px;
  color: #1d1d1f;
}

.card__header__airpodsmax {
  background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.card__watermark {
  overflow: hidden;
  position: absolute;
  bottom: 10px;
  left: 0;
  width: 100%;
}

.card__watermark::after {
  content: "MAX";
  position: relative;
  left: -20px;
  color: rgba(0, 0, 0, 0.3);
  font-size: 190px;
  font-weight: 700;
  text-transform: uppercase;
}

.card__logo {
  width: 36px;
  height: auto;
  margin-top: -10px;
}

.card__price {
  float: right;
  font-size: 16px;
  font-weight: 300;
}

.card__title {
  text-align: center;
  margin-top: 35px;
  font-size: 15px;
  line-height: 1.1em;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.card__subtitle {
  display: block;
  font-size: 13px;
  text-align: center;
  font-weight: 300;
}

.card__body {
  position: relative;
  padding: 40px 30px 20px;
}

.card__image {
  z-index: 1;
  position: absolute;
  top: -290px;
  left: -19px;
  width: 90%;
}

.card__buy {
  display: block;
  width: 50%;
  margin: 0 auto 15px;
  padding: 15px;
  border: 2px solid #fff;
  border-radius: 20px;
  text-align: center;
  text-transform: uppercase;
  font-size: 14px;
}

.card__buy__airpodsmax {
  color: #8850ff;
  border-color: #8850ff;
}

.card__buy__subtitle {
  display: block;
  font-size: 12px;
  color: #aeaeae;
  text-transform: uppercase;
  text-align: center;
}

              
            
!

JS

              
                var buy = document.querySelector(".card__buy");
buy.addEventListener("click", addBagPosition);
bagVisibility = false;

var bagCart = document.querySelector("#bag__cart");
bagCart.style.visibility = "hidden";
function visibleBag() {
  if ((bagVisibility = true)) {
    bagCart.style.visibility = "visible";
  } else {
    bagCart.style.visibility = "hidden";
  }
}
buy.addEventListener("click", visibleBag);
var contentdiv = document.querySelector(".wrapper");
var bagDelete = document.querySelector("#bag__delete");
bagDelete.addEventListener("click", deleteBagPosition);
var countBag = 0;
function deleteBagPosition() {
  var bagTitle = document.querySelector(".bag__title");

  if (countBag > 1) {
    countBag = countBag - 1;

    bagTitle.innerHTML = countBag + " x AIRPODS MAX";
  } else {
    countBag = 0;
    bagTitle.innerHTML = "Добавьте наушники";
  }
}

var bagAdd = document.querySelector("#bag__add");
bagAdd.addEventListener("click", addBagPosition);
function addBagPosition() {
  var bagTitle = document.querySelector(".bag__title");
  if (countBag >= 0) {
    countBag = countBag + 1;
    bagTitle.innerHTML = countBag + " x AIRPODS MAX";
  }
}
function addcart() {
  /*alert("Hello");
  var cartdiv = document.createElement("div");*/

  /*cartdiv.style.width = "100px";
  cartdiv.style.height = "100px";
  cartdiv.style.backgroundColor = "orange";
  cartdiv.style.position = "absolute";
  cartdiv.style.right = "10px";
  cartdiv.innerHTML = "!";
  contentdiv.appendChild(cartdiv);*/
  contentdiv.insertAdjacentHTML(
    "afterBegin",
    '<div style="width: 100px; height: 100px; background-color: orange; position: absolute; right: 10px; border-bottom-radius: 15px;">!</div>'
  );
}

              
            
!
999px

Console