module-3

 BRAKING BAD


HTML CODE

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>module 3</title>
    <link
      rel="stylesheet"
      href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap
.min.css"
      integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP
+VmmDGMN5t9UJ0Z"
      crossorigin="anonymous"
    />
    <script
      src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"
      integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8
/KUEfYiJOMMV+rV"
      crossorigin="anonymous"
    ></script>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <header class="center">
      <img src="images/logo.png" alt="" />
    </header>
    <div class="container">
      <div class="row">
        <div id="cards_container" class="col">
          <div class="card" style="background-color: black">
            <div class="card-inner">
              <div class="card-front">
                <img
                  src="https://vignette.wikia.nocookie.net/breakingbad/images/
b/b3/StaceyEhrmantraut.png/revision/latest?cb=20150310150049"
                  alt=""
                />
              </div>
              <div class="card-back">
                <div style="text-align: center">
                  <img
                    src="https://vignette.wikia.nocookie.net/breakingbad/images/
b/b3/StaceyEhrmantraut.png/revision/latest?cb=20150310150049"
                    alt=""
                  />
                </div>
                <h1>shivani</h1>
                <ul>
                  <li><strong>Actor Name:</strong> Kerry Condon</li>
                  <li><strong>Nickname:</strong> Stacey</li>
                  <li><strong>Birthday:</strong> Unknown</li>
                  <li><strong>Status:</strong> ?</li>
                </ul>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <script src="script.js"></script>
  </body>
</html>


CSS CODE

body {
    background#000 url(../images/background.jpgno-repeat 50% / cover;
    height100vh;
    color#fff;
  }
  .center {
    displayflex;
    justify-contentcenter;
  }
  
  .center img {
    width200px;
    margin-top100px;
  }
  
  #cards_container {
    margin-top100px;
    displaygrid;
    grid-template-columnsrepeat(41fr);
    grid-gap10px;
    padding50px;
  }
  .card {
    cursorpointer;
    background-colortransparent;
    height300px;
    perspective1000px;
  }
  
  .card-inner {
    positionrelative;
    width100%;
    height100%;
    transition: transform 0.8s;
    transform-stylepreserve-3d;
  }
  
  .card:hover .card-inner {
    transformrotateY(180deg);
  }
  
  .card-back,
  .card-front {
    positionabsolute;
    width100%;
    height100%;
    -webkit-backface-visibilityhidden;
    backface-visibilityhidden;
    border-radius10px;
  }
  
  .card-back {
    background-colorhsla(00%100% 0.91);
    colorrgb(255255255);
    padding20px;
    transformrotateY(180deg);
  }
  
  .card img {
    width100%;
  
    height300px;
    object-fitcover;
    border-radius10px;
  }
  
  .card-back img {
    marginauto;
    width100px;
    height100px;
    object-fitcover;
    border-radius50%;
  }
  
  .card h1 {
    font-size25px;
    border-bottom1px solid #fff;
    padding-bottom10px;
    margin-bottom10px;
  }
  
  .card li {
    list-stylenone;
    padding-bottom10px;
  }
  
  @media (max-width800px) {
    #cards_container {
      grid-template-columnsrepeat(21fr);
    }
  }
  
  @media (max-width500px) {
    #cards_container {
      grid-template-columnsrepeat(11fr);
    }
  }
  
  


JS CODE

///js 

let url = "https://breakingbadapi.com/api/characters";
let allnamecontainer = document.getElementById("cards_container");

fetch(url)
  .then((res=> res.json())
  .then((data=> {
    console.log(data);
    data.forEach((dataitem=> {
      let cardtemplate = `
<div class="card" style="background-color: black">
<div class="card-inner">
  <div class="card-front">
    <img
      src="${dataitem.img}"
      alt=""
    />
  </div>
  <div class="card-back">
    <div style="text-align: center">
      <img
        src="${dataitem.img}"
        alt=""
      />
    </div>
    <h1>${dataitem.name}</h1>
    <ul>
      <li><strong>Actor Name:</strong> ${dataitem.portrayed}</li>
      <li><strong>Nickname:</strong>  ${dataitem.nickname}</li>
      <li><strong>Birthday:</strong> ${dataitem.birthday}</li>
      <li><strong>Status:</strong> ${dataitem.status}</li>
    </ul>
  </div>
</div>
</div>
`;

      allnamecontainer.insertAdjacentHTML("afterbegin"cardtemplate);
    });
  });

Comments

Popular posts from this blog

Switching Tab in wix

Culture Interactive Project Research

Bootstrap /Flex-Boxs / Grids