Visor Técnico
Muescas geométricas que se ajustan en las 4 esquinas al interactuar.
Demo en vivo
Pasa el ratón sobre los botones para ver el efecto.
Cómo usar este efecto
Pega el HTML en tu página y el CSS en tu hoja de estilos. Cambia --btn-color, --btn-bg y --anim-speed según tu diseño.
<button class="hover-btn btn-size-md btn-hover-outline-notches">
<span>HoverLab</span>
<svg class="btn-icon btn-icon-right" width="18" height="18" viewBox="0 0 256 256" fill="currentColor"><path d="M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"></path></svg>
</button>
/* ==========================================
HoverLab Effect #16: 16. Visor Técnico
Self-Contained & Plug-and-Play CSS
========================================== */
:root {
--btn-color: #e6332a;
--btn-bg: #eeeeee;
--anim-speed: 0.35s;
}
/* Base Button Styles */
.hover-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 10px;
padding: 12px 28px;
font-family: inherit;
font-size: 15px;
font-weight: 500;
letter-spacing: -0.01em;
white-space: nowrap;
cursor: pointer;
background-color: transparent;
color: var(--btn-color, #e6332a);
border: 1.5px solid var(--btn-color, #e6332a);
border-radius: 9999px;
text-decoration: none;
user-select: none;
transition: all var(--anim-speed, 0.35s) cubic-bezier(0.16, 1, 0.3, 1);
box-sizing: border-box;
}
.hover-btn.btn-icon-only {
padding: 0 !important;
aspect-ratio: 1 / 1;
width: 44px;
height: 44px;
}
.hover-btn .btn-icon {
display: block;
flex-shrink: 0;
transition: transform var(--anim-speed, 0.35s) cubic-bezier(0.16, 1, 0.3, 1);
}
/* Effect Styles */
.btn-hover-outline-notches {
position: relative;
transition: transform var(--anim-speed, 0.3s) cubic-bezier(0.16, 1, 0.3, 1),
box-shadow var(--anim-speed, 0.3s) ease,
background-color var(--anim-speed, 0.3s) ease;
}
.btn-hover-outline-notches::before {
content: '';
position: absolute;
inset: -6px;
background:
linear-gradient(to right, var(--btn-color, #18181b) 2px, transparent 2px) top left / 10px 10px no-repeat,
linear-gradient(to bottom, var(--btn-color, #18181b) 2px, transparent 2px) top left / 10px 10px no-repeat,
linear-gradient(to left, var(--btn-color, #18181b) 2px, transparent 2px) top right / 10px 10px no-repeat,
linear-gradient(to bottom, var(--btn-color, #18181b) 2px, transparent 2px) top right / 10px 10px no-repeat,
linear-gradient(to right, var(--btn-color, #18181b) 2px, transparent 2px) bottom left / 10px 10px no-repeat,
linear-gradient(to top, var(--btn-color, #18181b) 2px, transparent 2px) bottom left / 10px 10px no-repeat,
linear-gradient(to left, var(--btn-color, #18181b) 2px, transparent 2px) bottom right / 10px 10px no-repeat,
linear-gradient(to top, var(--btn-color, #18181b) 2px, transparent 2px) bottom right / 10px 10px no-repeat;
opacity: 0;
transform: scale(1.22);
transition: transform var(--anim-speed, 0.35s) cubic-bezier(0.16, 1, 0.3, 1),
opacity var(--anim-speed, 0.35s) cubic-bezier(0.16, 1, 0.3, 1);
pointer-events: none;
}
.btn-hover-outline-notches::after {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
background-color: var(--btn-color, #18181b);
opacity: 0;
transform: scale(0.96);
transition: transform var(--anim-speed, 0.3s) cubic-bezier(0.16, 1, 0.3, 1),
opacity var(--anim-speed, 0.3s) ease;
pointer-events: none;
z-index: -1;
}
.btn-hover-outline-notches:hover::before {
opacity: 1;
transform: scale(1);
}
.btn-hover-outline-notches:hover::after {
opacity: 0.08;
transform: scale(1);
}
.btn-hover-outline-notches:hover {
transform: translateY(-2px);
box-shadow: 0 8px 24px -4px #0000001f;
}
.btn-hover-outline-notches:active {
transform: translateY(0);
}
.btn-hover-outline-notches .btn-icon {
transition: transform var(--anim-speed, 0.3s) cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-hover-outline-notches:hover .btn-icon {
transform: translateX(4px);
}
Cuándo usarlo
Los efectos de borde animan solo el contorno y dejan el texto intacto. Encajan en botones secundarios y ghost, navegación y tarjetas, donde el hover debe ser discreto junto a una acción principal.
Accesibilidad
Usa un elemento <button> o <a> real para que el efecto también funcione con el teclado: duplica los selectores :hover con :focus-visible. Para quienes prefieren menos movimiento, envuelve transiciones y animaciones en @media (prefers-reduced-motion: no-preference).
Compatibilidad
El efecto usa CSS estándar (transiciones, transformaciones, pseudo-elementos y variables CSS). Funciona en las versiones actuales de Chrome, Edge, Firefox y Safari, sin JavaScript ni dependencias.