Botón CSS: Rotación y Escalado en Click

  • Autor Autor Kiraxy
  • Fecha de inicio Fecha de inicio
Kiraxy

Kiraxy

VIP
Ro
Verificación en dos pasos activada
¡Ha verificado su Paypal!
Verificado por Binance
Suscripción a IA


Quiero que el boton rote y no se vea raro,

pero en mouse click se ponga chiquito desde el centro y no de lado manteniendo el ouline blanco y la sombra paralela uniforme poniendo chiquito...


ya no puedo, tengo horas intentando.
 
CSS:
@import url('https://fonts.googleapis.com/css?family=Montserrat:600&display=swap');

body {
  margin: 0;
  padding: 0;
  display: flex;
  height: 100vh;
  align-items: center;
  justify-content: center;
  background: #333; /* Fondo gris para mejor visualización */
}

span {
  position: relative;
  display: inline-flex;
  width: 180px;
  height: 55px;
  margin: 0 15px;
  perspective: 1000px;
  box-shadow: 8px 8px 20px rgba(0, 0, 0, 0.6), 0 0 0 4px #fff; /* Sombra gris y contorno blanco */
  justify-content: center;
}

span a {
  font-size: 19px;
  letter-spacing: 1px;
  transform-style: preserve-3d;
  transform: translateZ(-25px);
  transition: transform.25s, box-shadow.25s; /* Añadir transición para box-shadow */
  font-family: 'Montserrat', sans-serif;
  position: relative;
  background-clip: padding-box;
  display: flex;
  justify-content: center;
  align-items: center;
}

span a:before,
span a:after {
  position: absolute;
  content: "BUTTON";
  height: 55px;
  width: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 5px solid black;
  box-sizing: border-box;
  border-radius: 0; /* Asegurarse de que no haya redondeo */
  background: #1b221b; /* Color de fondo actualizado */
}

span a:before {
  color: #fff;
  transform: rotateY(0deg) translateZ(25px);
}

span a:after {
  color: #000;
  background: #fff;
  transform: rotateX(90deg) translateZ(25px);
}

span a:hover {
  transform: translateZ(-25px) rotateX(-90deg);
  box-shadow: 8px 8px 20px rgba(0, 0, 0, 0.6), 0 0 0 4px #fff; /* Mantener el contorno blanco durante el hover */
}

span a:active {
  transform: scale(0.8) translateZ(-30px) rotateX(-90deg);
  transform-origin: center; /* Añadir este propiedad para que el botón se reduzca desde el centro */
  box-shadow: 6.4px 6.4px 16px rgba(0, 0, 0, 0.6), 0 0 0 3.2px #fff; /* Reducción proporcional del contorno blanco */
}
 
CSS:
@import url('https://fonts.googleapis.com/css?family=Montserrat:600&display=swap');

body {
  margin: 0;
  padding: 0;
  display: flex;
  height: 100vh;
  align-items: center;
  justify-content: center;
  background: #333; /* Fondo gris para mejor visualización */
}

span {
  position: relative;
  display: inline-flex;
  width: 180px;
  height: 55px;
  margin: 0 15px;
  perspective: 1000px;
  box-shadow: 8px 8px 20px rgba(0, 0, 0, 0.6), 0 0 0 4px #fff; /* Sombra gris y contorno blanco */
  justify-content: center;
}

span a {
  font-size: 19px;
  letter-spacing: 1px;
  transform-style: preserve-3d;
  transform: translateZ(-25px);
  transition: transform.25s, box-shadow.25s; /* Añadir transición para box-shadow */
  font-family: 'Montserrat', sans-serif;
  position: relative;
  background-clip: padding-box;
  display: flex;
  justify-content: center;
  align-items: center;
}

span a:before,
span a:after {
  position: absolute;
  content: "BUTTON";
  height: 55px;
  width: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 5px solid black;
  box-sizing: border-box;
  border-radius: 0; /* Asegurarse de que no haya redondeo */
  background: #1b221b; /* Color de fondo actualizado */
}

span a:before {
  color: #fff;
  transform: rotateY(0deg) translateZ(25px);
}

span a:after {
  color: #000;
  background: #fff;
  transform: rotateX(90deg) translateZ(25px);
}

span a:hover {
  transform: translateZ(-25px) rotateX(-90deg);
  box-shadow: 8px 8px 20px rgba(0, 0, 0, 0.6), 0 0 0 4px #fff; /* Mantener el contorno blanco durante el hover */
}

span a:active {
  transform: scale(0.8) translateZ(-30px) rotateX(-90deg);
  transform-origin: center; /* Añadir este propiedad para que el botón se reduzca desde el centro */
  box-shadow: 6.4px 6.4px 16px rgba(0, 0, 0, 0.6), 0 0 0 3.2px #fff; /* Reducción proporcional del contorno blanco */
}
Increíble, espectacular... Solo que el contorno blanco no se reduce de tamaño
 
Increíble, espectacular... Solo que el contorno blanco no se reduce de tamaño
Hablas del box en el que está el boton? Deja y prendo el PC y miro 🫡
 
Hablas del box en el que está el boton? Deja y prendo el PC y miro 🫡
Si, el recuerdo blanco no se pone chiquito cuando le doy click...

Solo el boton

1717522438175.webp
S
 
No sé si me entere que es lo que quieres, pero edite la última línea imagino que será eso.

Insertar CODE, HTML o PHP:
  @import url('https://fonts.googleapis.com/css?family=Montserrat:600&display=swap');
body {
  margin: 0;
  padding: 0;
  display: flex;
  height: 100vh;
  align-items: center;
  justify-content: center;
  background: #333; /* Fondo gris para mejor visualización */
}

span {
  position: relative;
  display: inline-flex;
  width: 180px;
  height: 55px;
  margin: 0 15px;
  perspective: 1000px;
  box-shadow: 8px 8px 20px rgba(0, 0, 0, 0.6), 0 0 0 4px #fff; /* Sombra gris y contorno blanco */
}

span a {
  font-size: 19px;
  letter-spacing: 1px;
  transform-style: preserve-3d;
  transform: translateZ(-25px);
  transition: transform .25s, box-shadow .25s; /* Añadir transición para box-shadow */
  font-family: 'Montserrat', sans-serif;
  position: relative;
  background-clip: padding-box;
}

span a:before,
span a:after {
  position: absolute;
  content: "BUTTON";
  height: 55px;
  width: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 5px solid black;
  box-sizing: border-box;
  border-radius: 0; /* Asegurarse de que no haya redondeo */
  background: #1b221b; /* Color de fondo actualizado */
}

span a:before {
  color: #fff;
  transform: rotateY(0deg) translateZ(25px);
}

span a:after {
  color: #000;
  background: #fff;
  transform: rotateX(90deg) translateZ(25px);
}

span a:hover {
  transform: translateZ(-25px) rotateX(-90deg);
  box-shadow: 8px 8px 20px rgba(0, 0, 0, 0.6), 0 0 0 4px #fff; /* Mantener el contorno blanco durante el hover */
}

span:has(a:active){
  transition: transform .25s;
  transform: scale(0.8) ; /* Reducción de tamaño al hacer click */
  box-shadow: 6.4px 6.4px 16px rgba(0, 0, 0, 0.6), 0 0 0 3.2px #fff; /* Reducción proporcional del contorno blanco */
}
 
No sé si me entere que es lo que quieres, pero edite la última línea imagino que será eso.

Insertar CODE, HTML o PHP:
  @import url('https://fonts.googleapis.com/css?family=Montserrat:600&display=swap');
body {
  margin: 0;
  padding: 0;
  display: flex;
  height: 100vh;
  align-items: center;
  justify-content: center;
  background: #333; /* Fondo gris para mejor visualización */
}

span {
  position: relative;
  display: inline-flex;
  width: 180px;
  height: 55px;
  margin: 0 15px;
  perspective: 1000px;
  box-shadow: 8px 8px 20px rgba(0, 0, 0, 0.6), 0 0 0 4px #fff; /* Sombra gris y contorno blanco */
}

span a {
  font-size: 19px;
  letter-spacing: 1px;
  transform-style: preserve-3d;
  transform: translateZ(-25px);
  transition: transform .25s, box-shadow .25s; /* Añadir transición para box-shadow */
  font-family: 'Montserrat', sans-serif;
  position: relative;
  background-clip: padding-box;
}

span a:before,
span a:after {
  position: absolute;
  content: "BUTTON";
  height: 55px;
  width: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 5px solid black;
  box-sizing: border-box;
  border-radius: 0; /* Asegurarse de que no haya redondeo */
  background: #1b221b; /* Color de fondo actualizado */
}

span a:before {
  color: #fff;
  transform: rotateY(0deg) translateZ(25px);
}

span a:after {
  color: #000;
  background: #fff;
  transform: rotateX(90deg) translateZ(25px);
}

span a:hover {
  transform: translateZ(-25px) rotateX(-90deg);
  box-shadow: 8px 8px 20px rgba(0, 0, 0, 0.6), 0 0 0 4px #fff; /* Mantener el contorno blanco durante el hover */
}

span:has(a:active){
  transition: transform .25s;
  transform: scale(0.8) ; /* Reducción de tamaño al hacer click */
  box-shadow: 6.4px 6.4px 16px rgba(0, 0, 0, 0.6), 0 0 0 3.2px #fff; /* Reducción proporcional del contorno blanco */
}
Por dios santo, si exactamente eso, como saben tanto?, por que sabes tanto?, GRACIAS además por tomarte el tiempo de ayudar a un ramdom de internet.
 
Por dios santo, si exactamente eso, como saben tanto?, por que sabes tanto?, GRACIAS además por tomarte el tiempo de ayudar a un ramdom de internet.
Qué bueno que te sirva 👍
 
Atrás
Arriba