정보실

웹학교

정보실

css Solar CSSystem

본문

https://codepen.io/robdimarzo/pen/LMOLer 


HTML:

<article class="card card--mercury">

  <div class="card__planet">

    <div class="planet__atmosphere">

      <div class="planet__surface"></div>

    </div>

  </div>

  <div class="card__info">

    <h2 class="info__title">mercury</h2>

    <div class="info__form">

      <div class="info__item">

        <label class="info__label">Tilt</label><span class="info__line"></span><i class=" tilt__icon fas fa-long-arrow-alt-right"></i><span class="info__detail">0.034°      </span>

      </div>

      <div class="info__item">

        <label class="info__label">Day</label><span class="info__line"></span><span class="info__detail">1,407 hours</span>

      </div>

      <div class="info__item">

        <label class="info__label">Year</label><span class="info__line"></span><span class="info__detail">88 days</span>

      </div>

    </div>

  </div>

</article>

<article class="card card--venus">

  <div class="card__planet">

    <div class="planet__atmosphere">

      <div class="planet__surface"></div>

    </div>

  </div>

  <div class="card__info">

    <h2 class="info__title">venus</h2>

    <div class="info__form">

      <div class="info__item">

        <label class="info__label">Tilt</label><span class="info__line"></span><i class=" tilt__icon fas fa-long-arrow-alt-right"></i><span class="info__detail">177.3°      </span>

      </div>

      <div class="info__item">

        <label class="info__label">Day</label><span class="info__line"></span><span class="info__detail">5,832 hours</span>

      </div>

      <div class="info__item">

        <label class="info__label">Year</label><span class="info__line"></span><span class="info__detail">224.7 days</span>

      </div>

    </div>

  </div>

</article>

<article class="card card--earth">

  <div class="card__planet">

    <div class="planet__atmosphere">

      <div class="planet__surface"></div>

    </div>

  </div>

  <div class="card__info">

    <h2 class="info__title">earth</h2>

    <div class="info__form">

      <div class="info__item">

        <label class="info__label">Tilt</label><span class="info__line"></span><i class=" tilt__icon fas fa-long-arrow-alt-right"></i><span class="info__detail">23.26°      </span>

      </div>

      <div class="info__item">

        <label class="info__label">Day</label><span class="info__line"></span><span class="info__detail">23.9 hours</span>

      </div>

      <div class="info__item">

        <label class="info__label">Year</label><span class="info__line"></span><span class="info__detail">365.2 days</span>

      </div>

    </div>

  </div>

</article>

<article class="card card--mars">

  <div class="card__planet">

    <div class="planet__atmosphere">

      <div class="planet__surface"></div>

    </div>

  </div>

  <div class="card__info">

    <h2 class="info__title">mars</h2>

    <div class="info__form">

      <div class="info__item">

        <label class="info__label">Tilt</label><span class="info__line"></span><i class=" tilt__icon fas fa-long-arrow-alt-right"></i><span class="info__detail">25.2°      </span>

      </div>

      <div class="info__item">

        <label class="info__label">Day</label><span class="info__line"></span><span class="info__detail">24.6 hours</span>

      </div>

      <div class="info__item">

        <label class="info__label">Year</label><span class="info__line"></span><span class="info__detail">687 days</span>

      </div>

    </div>

  </div>

</article>

<article class="card card--jupiter">

  <div class="card__planet">

    <div class="planet__atmosphere">

      <div class="planet__surface"></div>

    </div>

  </div>

  <div class="card__info">

    <h2 class="info__title">jupiter</h2>

    <div class="info__form">

      <div class="info__item">

        <label class="info__label">Tilt</label><span class="info__line"></span><i class=" tilt__icon fas fa-long-arrow-alt-right"></i><span class="info__detail">3.1°      </span>

      </div>

      <div class="info__item">

        <label class="info__label">Day</label><span class="info__line"></span><span class="info__detail">9.9 hours</span>

      </div>

      <div class="info__item">

        <label class="info__label">Year</label><span class="info__line"></span><span class="info__detail">4,331 days</span>

      </div>

    </div>

  </div>

</article>

<article class="card card--saturn">

  <div class="card__planet">

    <div class="planet__atmosphere">

      <div class="planet__surface"></div>

    </div>

  </div>

  <div class="card__info">

    <h2 class="info__title">saturn</h2>

    <div class="info__form">

      <div class="info__item">

        <label class="info__label">Tilt</label><span class="info__line"></span><i class=" tilt__icon fas fa-long-arrow-alt-right"></i><span class="info__detail">26.7°      </span>

      </div>

      <div class="info__item">

        <label class="info__label">Day</label><span class="info__line"></span><span class="info__detail">10.7 hours</span>

      </div>

      <div class="info__item">

        <label class="info__label">Year</label><span class="info__line"></span><span class="info__detail">10,747 days</span>

      </div>

    </div>

  </div>

</article>

<article class="card card--uranus">

  <div class="card__planet">

    <div class="planet__atmosphere">

      <div class="planet__surface"></div>

    </div>

  </div>

  <div class="card__info">

    <h2 class="info__title">uranus</h2>

    <div class="info__form">

      <div class="info__item">

        <label class="info__label">Tilt</label><span class="info__line"></span><i class=" tilt__icon fas fa-long-arrow-alt-right"></i><span class="info__detail">97.8°      </span>

      </div>

      <div class="info__item">

        <label class="info__label">Day</label><span class="info__line"></span><span class="info__detail">17.2 hours</span>

      </div>

      <div class="info__item">

        <label class="info__label">Year</label><span class="info__line"></span><span class="info__detail">30,589 days</span>

      </div>

    </div>

  </div>

</article>

<article class="card card--neptune">

  <div class="card__planet">

    <div class="planet__atmosphere">

      <div class="planet__surface"></div>

    </div>

  </div>

  <div class="card__info">

    <h2 class="info__title">neptune</h2>

    <div class="info__form">

      <div class="info__item">

        <label class="info__label">Tilt</label><span class="info__line"></span><i class=" tilt__icon fas fa-long-arrow-alt-right"></i><span class="info__detail">28.3°      </span>

      </div>

      <div class="info__item">

        <label class="info__label">Day</label><span class="info__line"></span><span class="info__detail">16.1 hours</span>

      </div>

      <div class="info__item">

        <label class="info__label">Year</label><span class="info__line"></span><span class="info__detail">59,800 days</span>

      </div>

    </div>

  </div>

</article>

<article class="card card--pluto">

  <div class="card__planet">

    <div class="planet__atmosphere">

      <div class="planet__surface"></div>

    </div>

  </div>

  <div class="card__info">

    <h2 class="info__title">pluto</h2>

    <div class="info__form">

      <div class="info__item">

        <label class="info__label">Tilt</label><span class="info__line"></span><i class=" tilt__icon fas fa-long-arrow-alt-right"></i><span class="info__detail">122.5°      </span>

      </div>

      <div class="info__item">

        <label class="info__label">Day</label><span class="info__line"></span><span class="info__detail">153.3 hours</span>

      </div>

      <div class="info__item">

        <label class="info__label">Year</label><span class="info__line"></span><span class="info__detail">90,560 days</span>

      </div>

    </div>

  </div>

</article>

<article class="card card--sun">

  <div class="card__planet">

    <div class="planet__atmosphere">

      <div class="planet__surface"></div>

    </div>

  </div>

  <div class="card__info">

    <h2 class="info__title">sun</h2>

    <div class="info__form">

      <div class="info__item">

        <label class="info__label">Tilt</label><span class="info__line"></span><i class=" tilt__icon fas fa-long-arrow-alt-right"></i><span class="info__detail">0°      </span>

      </div>

      <div class="info__item">

        <label class="info__label">Day</label><span class="info__line"></span><span class="info__detail">~600 hours</span>

      </div>

      <div class="info__item">

        <label class="info__label">Year</label><span class="info__line"></span><span class="info__detail">0 days</span>

      </div>

    </div>

  </div>

</article>


CSS

:root {

  --mercury-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/332937/mercury2.jpg);

  --mercury-tilt: rotate(0.034deg);

  --mercury-day: 1407.6;

  --mercury-color: #999999;

  --venus-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/332937/venus2.jpg);

  --venus-tilt: rotate(177.3deg);

  --venus-day: 5832.5;

  --venus-color: #e8cda2;

  --earth-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/332937/earth.jpg);

  --earth-tilt: rotate(23.26deg);

  --earth-day: 23.9;

  --earth-color: #b3caff;

  --mars-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/332937/mars.jpg);

  --mars-tilt: rotate(25.2deg);

  --mars-day: 24.6;

  --mars-color: #c07158;

  --jupiter-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/332937/jupiter.jpg);

  --jupiter-tilt: rotate(3.1deg);

  --jupiter-day: 9.9;

  --jupiter-color: #c9b5a4;

  --saturn-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/332937/saturn.jpg);

  --saturn-tilt: rotate(26.7deg);

  --saturn-day: 10.7;

  --saturn-color: #f0e2c4;

  --uranus-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/332937/uranus2.jpg);

  --uranus-tilt: rotate(97.8deg);

  --uranus-day: 17.2;

  --uranus-color: #b8d8e1;

  --neptune-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/332937/neptune.jpg);

  --neptune-tilt: rotate(28.3deg);

  --neptune-day: 16.1;

  --neptune-color: #5e73bb;

  --pluto-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/332937/pluto.jpg);

  --pluto-tilt: rotate(122.5deg);

  --pluto-day: 153.3;

  --pluto-color: #c3b6aa;

  --sun-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/332937/sun.jpg);

  --sun-tilt: rotate(0deg);

  --sun-day: 600;

  --sun-color: #cc9f4c;

}


@keyframes planetRotate {

  0% {

    background-position: 0% center;

  }

  100% {

    background-position: -200% center;

  }

}

body {

  background: #000000;

  color: #fff;

  height: 100%;

  width: 100vw;

  margin: 10px 0 40px 0;

  display: grid;

  grid-template-columns: repeat(auto-fill, 190px);

  grid-template-rows: repeat(auto-fill, 400px);

  grid-gap: 40px;

  align-items: center;

  justify-items: center;

  justify-content: center;

  overflow-x: hidden;

  font-family: "Major Mono Display";

  text-transform: lowercase;

}


.card {

  display: flex;

  flex-direction: column;

  align-items: center;

  position: relative;

}

.card--mercury .planet__atmosphere {

  box-shadow: inset 10px 0px 12px -2px rgba(255, 255, 255, 0.2), inset -70px 0px 50px 0px black, -5px 0px 10px -4px var(--mercury-color);

}

.card--mercury .planet__surface {

  background-image: var(--mercury-image);

  transform: var(--mercury-tilt) scale(1.2);

  animation: planetRotate calc(var(--mercury-day)*.1s) linear infinite;

}

.card--mercury .card__planet::before {

  transform: var(--mercury-tilt) scale(1.2);

  border-color: var(--mercury-color);

  color: var(--mercury-color);

}

.card--mercury .tilt__icon {

  transform: var(--mercury-tilt);

  color: var(--mercury-color);

}

.card--venus .planet__atmosphere {

  box-shadow: inset 10px 0px 12px -2px rgba(255, 255, 255, 0.2), inset -70px 0px 50px 0px black, -5px 0px 10px -4px var(--venus-color);

}

.card--venus .planet__surface {

  background-image: var(--venus-image);

  transform: var(--venus-tilt) scale(1.2);

  animation: planetRotate calc(var(--venus-day)*.1s) linear infinite;

}

.card--venus .card__planet::before {

  transform: var(--venus-tilt) scale(1.2);

  border-color: var(--venus-color);

  color: var(--venus-color);

}

.card--venus .tilt__icon {

  transform: var(--venus-tilt);

  color: var(--venus-color);

}

.card--earth .planet__atmosphere {

  box-shadow: inset 10px 0px 12px -2px rgba(255, 255, 255, 0.2), inset -70px 0px 50px 0px black, -5px 0px 10px -4px var(--earth-color);

}

.card--earth .planet__surface {

  background-image: var(--earth-image);

  transform: var(--earth-tilt) scale(1.2);

  animation: planetRotate calc(var(--earth-day)*.1s) linear infinite;

}

.card--earth .card__planet::before {

  transform: var(--earth-tilt) scale(1.2);

  border-color: var(--earth-color);

  color: var(--earth-color);

}

.card--earth .tilt__icon {

  transform: var(--earth-tilt);

  color: var(--earth-color);

}

.card--mars .planet__atmosphere {

  box-shadow: inset 10px 0px 12px -2px rgba(255, 255, 255, 0.2), inset -70px 0px 50px 0px black, -5px 0px 10px -4px var(--mars-color);

}

.card--mars .planet__surface {

  background-image: var(--mars-image);

  transform: var(--mars-tilt) scale(1.2);

  animation: planetRotate calc(var(--mars-day)*.1s) linear infinite;

}

.card--mars .card__planet::before {

  transform: var(--mars-tilt) scale(1.2);

  border-color: var(--mars-color);

  color: var(--mars-color);

}

.card--mars .tilt__icon {

  transform: var(--mars-tilt);

  color: var(--mars-color);

}

.card--jupiter .planet__atmosphere {

  box-shadow: inset 10px 0px 12px -2px rgba(255, 255, 255, 0.2), inset -70px 0px 50px 0px black, -5px 0px 10px -4px var(--jupiter-color);

}

.card--jupiter .planet__surface {

  background-image: var(--jupiter-image);

  transform: var(--jupiter-tilt) scale(1.2);

  animation: planetRotate calc(var(--jupiter-day)*.1s) linear infinite;

}

.card--jupiter .card__planet::before {

  transform: var(--jupiter-tilt) scale(1.2);

  border-color: var(--jupiter-color);

  color: var(--jupiter-color);

}

.card--jupiter .tilt__icon {

  transform: var(--jupiter-tilt);

  color: var(--jupiter-color);

}

.card--saturn .planet__atmosphere {

  box-shadow: inset 10px 0px 12px -2px rgba(255, 255, 255, 0.2), inset -70px 0px 50px 0px black, -5px 0px 10px -4px var(--saturn-color);

}

.card--saturn .planet__surface {

  background-image: var(--saturn-image);

  transform: var(--saturn-tilt) scale(1.2);

  animation: planetRotate calc(var(--saturn-day)*.1s) linear infinite;

}

.card--saturn .card__planet::before {

  transform: var(--saturn-tilt) scale(1.2);

  border-color: var(--saturn-color);

  color: var(--saturn-color);

}

.card--saturn .tilt__icon {

  transform: var(--saturn-tilt);

  color: var(--saturn-color);

}

.card--uranus .planet__atmosphere {

  box-shadow: inset 10px 0px 12px -2px rgba(255, 255, 255, 0.2), inset -70px 0px 50px 0px black, -5px 0px 10px -4px var(--uranus-color);

}

.card--uranus .planet__surface {

  background-image: var(--uranus-image);

  transform: var(--uranus-tilt) scale(1.2);

  animation: planetRotate calc(var(--uranus-day)*.1s) linear infinite;

}

.card--uranus .card__planet::before {

  transform: var(--uranus-tilt) scale(1.2);

  border-color: var(--uranus-color);

  color: var(--uranus-color);

}

.card--uranus .tilt__icon {

  transform: var(--uranus-tilt);

  color: var(--uranus-color);

}

.card--neptune .planet__atmosphere {

  box-shadow: inset 10px 0px 12px -2px rgba(255, 255, 255, 0.2), inset -70px 0px 50px 0px black, -5px 0px 10px -4px var(--neptune-color);

}

.card--neptune .planet__surface {

  background-image: var(--neptune-image);

  transform: var(--neptune-tilt) scale(1.2);

  animation: planetRotate calc(var(--neptune-day)*.1s) linear infinite;

}

.card--neptune .card__planet::before {

  transform: var(--neptune-tilt) scale(1.2);

  border-color: var(--neptune-color);

  color: var(--neptune-color);

}

.card--neptune .tilt__icon {

  transform: var(--neptune-tilt);

  color: var(--neptune-color);

}

.card--pluto .planet__atmosphere {

  box-shadow: inset 10px 0px 12px -2px rgba(255, 255, 255, 0.2), inset -70px 0px 50px 0px black, -5px 0px 10px -4px var(--pluto-color);

}

.card--pluto .planet__surface {

  background-image: var(--pluto-image);

  transform: var(--pluto-tilt) scale(1.2);

  animation: planetRotate calc(var(--pluto-day)*.1s) linear infinite;

}

.card--pluto .card__planet::before {

  transform: var(--pluto-tilt) scale(1.2);

  border-color: var(--pluto-color);

  color: var(--pluto-color);

}

.card--pluto .tilt__icon {

  transform: var(--pluto-tilt);

  color: var(--pluto-color);

}

.card--sun .planet__atmosphere {

  box-shadow: inset 10px 0px 12px -2px rgba(255, 255, 255, 0.2), inset -70px 0px 50px 0px black, -5px 0px 10px -4px var(--sun-color);

}

.card--sun .planet__surface {

  background-image: var(--sun-image);

  transform: var(--sun-tilt) scale(1.2);

  animation: planetRotate calc(var(--sun-day)*.1s) linear infinite;

}

.card--sun .card__planet::before {

  transform: var(--sun-tilt) scale(1.2);

  border-color: var(--sun-color);

  color: var(--sun-color);

}

.card--sun .tilt__icon {

  transform: var(--sun-tilt);

  color: var(--sun-color);

}


.card__planet::before {

  content: '';

  position: absolute;

  height: 190px;

  z-index: -2;

  left: 50%;

  top: 0%;

  border-left: 1px dashed rgba(255, 255, 255, 0.25);

}


.planet__atmosphere {

  height: 190px;

  width: 190px;

  position: relative;

  background: radial-gradient(circle at 30% 50%, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 65%);

  border-radius: 100px;

  overflow: hidden;

}

.planet__surface {

  position: absolute;

  height: 100%;

  width: 100%;

  z-index: -1;

  background-size: cover;

}


.card--sun .planet__atmosphere {

  box-shadow: 0px 0px 10px 0px var(--sun-color), 0px 0px 1000px -2px var(--sun-color);

}


.card__info {

  width: 100%;

}


.info__title {

  text-align: center;

  font-size: 28px;

}

.info__form {

  display: flex;

  flex-direction: column;

  justify-content: space-between;

}

.info__item {

  display: flex;

  align-items: flex-end;

  margin-bottom: 5px;

  font-size: 14px;

}

.info__item .tilt__icon {

  margin: 0 5px;

}

.info__label {

  font-size: 11px;

}

.info__line {

  flex: 1;

  margin: 0 5px;

  border-bottom: 1px dashed rgba(255, 255, 255, 0.3);

}





페이지 정보

조회 416회 ]  작성일19-04-23 20:29

웹학교