How can i convert this button in responsive?

时间:2017-06-15 10:30:51

标签: html css responsive-design

I'm trying to convert this button in responsive but i don't know how, i want this 4 button display verticaly aligned only on mobile. I didn't find any site for this problem :(. Thank you for all the answer!

.rainbow {
  position: absolute;
  top: -3px;
  right: -3px;
  bottom: -3px;
  left: -3px;
  z-index: 1;
  background: linear-gradient(124deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #dd00f3);
  background-size: 1800% 1800%;
  -webkit-animation: rainbow 7s ease infinite;
  -z-animation: rainbow 7s ease infinite;
  -o-animation: rainbow 7s ease infinite;
  animation: rainbow 7s ease infinite;
  mix-blend-mode: screen;
}

.bottoni {
  float: center;
  margin: 0 auto;
  text-align: center;
  margin-top: 7%;
}

.bottone {
  display: inline-block;
  position: relative;
  padding-top: 17px;
  text-align: center;
  font-family: sans-serif;
  width: 100% auto;
  font-weight: bold;
  margin-right: 20px;
  margin-left: 20px;
  text-transform: uppercase;
  width: 200px;
  height: 35px;
  border: 3px solid black;
  background: white;
  transform: 1s;
  -webkit-transform: perspective(1px) translateZ(0);
  transform: perspective(1px) translateZ(0);
  box-shadow: 0 0 1px transparent;
  position: relative;
  -webkit-transition-duration: 0.3s;
  transition-duration: 0.3s;
  -webkit-transition-property: transform;
  transition-property: transform;
 -webkit-animation: bottoni 1s ease 0s 1 normal ;
 animation: bottoni 1s ease 0s 1 normal ;
}

.bottone:before {
  pointer-events: none;
  position: absolute;
  z-index: -1;
  content: '';
  top: 100%;
  left: 5%;
  height: 10px;
  width: 90%;
  opacity: 0;
  background: -webkit-radial-gradient(center, ellipse, rgba(0, 0, 0, 0.35) 0%, transparent 80%);
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.35) 0%, transparent 80%);
  /* W3C */
  -webkit-transition-duration: 0.3s;
  transition-duration: 0.3s;
  -webkit-transition-property: transform, opacity;
  transition-property: transform, opacity;
  }

.bottone:hover, .bottone:focus, .bottone:active {
  cursor: pointer;
  -webkit-transform: translateY(-10px);
  transform: translateY(-10px);
}

 .bottone:hover:before, .bottone:focus:before, .bottone:active:before {
opacity: 1;
  -webkit-transform: translateY(10px);
  transform: translateY(10px);
}

/* Animation */

@-webkit-keyframes rainbow {
  0% {
    background-position: 0% 82%
  }
  50% {
    background-position: 100% 19%
  }
  100% {
    background-position: 0% 82%
  }
}

@-moz-keyframes rainbow {
  0% {
    background-position: 0% 82%
  }
  50% {
    background-position: 100% 19%
  }
  100% {
    background-position: 0% 82%
  }
}

@-o-keyframes rainbow {
  0% {
    background-position: 0% 82%
  }
  50% {
    background-position: 100% 19%
  }
  100% {
    background-position: 0% 82%
  }
}

@keyframes rainbow {
  0% {
    background-position: 0% 82%
  }
  50% {
    background-position: 100% 19%
  }
  100% {
    background-position: 0% 82%
  }
}
<div class="bottoni">
<a class="bottone">
  Votaci
  <div class="rainbow"></div>
</a>

<a class="bottone">
  forum
  <div class="rainbow"></div>
</a>

<a class="bottone">
  regolamento
  <div class="rainbow"></div>
</a>

<a class="bottone">
  shop
  <div class="rainbow"></div>
</a>
</div>

All answer are apprecited

3 个答案:

答案 0 :(得分:1)

You could use absolute position on mobile on .bottoni to center your menu verticaly, for the responsive use media queries :

@media (max-width: 480px) {
    .bottoni {
        top: 50%; /* adjust to your needs */
        position: absolute;
        left: 0;
        right: 0;
    }
}

see the : https://jsfiddle.net/s0smLw16/

答案 1 :(得分:0)

.rainbow {
  position: absolute;
  top: -3px;
  right: -3px;
  bottom: -3px;
  left: -3px;
  z-index: 1;
  background: linear-gradient(124deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #dd00f3);
  background-size: 1800% 1800%;
  -webkit-animation: rainbow 7s ease infinite;
  -z-animation: rainbow 7s ease infinite;
  -o-animation: rainbow 7s ease infinite;
  animation: rainbow 7s ease infinite;
  mix-blend-mode: screen;
}

.bottoni {
  float: center;
  margin: 0 auto;
  text-align: center;
  margin-top: 7%;
}

.bottone {
  display: inline-block;
  position: relative;
  padding-top: 17px;
  text-align: center;
  font-family: sans-serif;
  width: 100% auto;
  font-weight: bold;
  margin-right: 20px;
  margin-left: 20px;
  text-transform: uppercase;
  width: 200px;
  height: 35px;
  border: 3px solid black;
  background: white;
  transform: 1s;
  -webkit-transform: perspective(1px) translateZ(0);
  transform: perspective(1px) translateZ(0);
  box-shadow: 0 0 1px transparent;
  position: relative;
  -webkit-transition-duration: 0.3s;
  transition-duration: 0.3s;
  -webkit-transition-property: transform;
  transition-property: transform;
 -webkit-animation: bottoni 1s ease 0s 1 normal ;
 animation: bottoni 1s ease 0s 1 normal ;
}

.bottone:before {
  pointer-events: none;
  position: absolute;
  z-index: -1;
  content: '';
  top: 100%;
  left: 5%;
  height: 10px;
  width: 90%;
  opacity: 0;
  background: -webkit-radial-gradient(center, ellipse, rgba(0, 0, 0, 0.35) 0%, transparent 80%);
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.35) 0%, transparent 80%);
  /* W3C */
  -webkit-transition-duration: 0.3s;
  transition-duration: 0.3s;
  -webkit-transition-property: transform, opacity;
  transition-property: transform, opacity;
  }

.bottone:hover, .bottone:focus, .bottone:active {
  cursor: pointer;
  -webkit-transform: translateY(-10px);
  transform: translateY(-10px);
}

 .bottone:hover:before, .bottone:focus:before, .bottone:active:before {
opacity: 1;
  -webkit-transform: translateY(10px);
  transform: translateY(10px);
}

/* Animation */

@-webkit-keyframes rainbow {
  0% {
    background-position: 0% 82%
  }
  50% {
    background-position: 100% 19%
  }
  100% {
    background-position: 0% 82%
  }
}

@-moz-keyframes rainbow {
  0% {
    background-position: 0% 82%
  }
  50% {
    background-position: 100% 19%
  }
  100% {
    background-position: 0% 82%
  }
}

@-o-keyframes rainbow {
  0% {
    background-position: 0% 82%
  }
  50% {
    background-position: 100% 19%
  }
  100% {
    background-position: 0% 82%
  }
}

@keyframes rainbow {
  0% {
    background-position: 0% 82%
  }
  50% {
    background-position: 100% 19%
  }
  100% {
    background-position: 0% 82%
  }
}
@media only screen and (min-width: 480px) {
    .bottoni {
    top: 50%; /* adjust to your needs */
    position: absolute;
    left: 0;
    right: 0;
    }
}
<div class="bottoni">
<a class="bottone">
  Votaci
  <div class="rainbow"></div>
</a>

<a class="bottone">
  forum
  <div class="rainbow"></div>
</a>

<a class="bottone">
  regolamento
  <div class="rainbow"></div>
</a>

<a class="bottone">
  shop
  <div class="rainbow"></div>
</a>
</div>

you can use css @media

@media screen and (min-width: 480px // size of the screen) {}

答案 2 :(得分:0)

尝试向您的css添加var cmd = require('node-cmd'); cmd.get('WMIC /node:"ABC-XXXXXXX" process call create "C:\\Setup\\app7.exe"',function(err, data, stderr){ console.log('err:', err) console.log('stderr:', stderr) }) 选择器。

@media

示例:https://jsfiddle.net/qpe2xoem/1/