Howto make an HTML box with shadow and pressable -
i make html widget one: https://jsfiddle.net/api/mdn/
.simple { box-shadow: 5px 5px 5px rgba(0,0,0,0.7); }
but pressable flattens 1 second , redirects different url.
edit:
i tried following:
button { width: 150px; font-size: 1.1rem; line-height: 2; border-radius: 10px; border: none; background-image: linear-gradient(to bottom right, #777, #ddd); box-shadow: 5px 5px 5px rgba(0,0,0,0.7); } button:focus, button:hover { background-image: linear-gradient(to bottom right, #888, #eee); } button:active { box-shadow: inset 2px 2px 1px black, inset 2px 3px 5px rgba(0,0,0,0.3), inset -2px -3px 5px rgba(255,255,255,0.5); } <button>press me!</button>
https://jsfiddle.net/z7a0v8uv/
but don't know how translate content of button make it's being pressed down.
i found answer here: https://www.w3schools.com/howto/howto_css_animate_buttons.asp
i looking for:
translatex(...) translatey(...)
as can see in working example:
https://jsfiddle.net/z7a0v8uv/1/
now need integrate right style.
edit:
here complete css code:
button { width: 100%; border: none; box-shadow: 5px 5px 5px rgba(0,0,0,0.7); } button:focus, button:hover { background-image: linear-gradient(to bottom right, #888, #eee); } button:active { box-shadow: 2px 2px 2px rgba(0,0,0,0.7); transform: translatey(3px) translatex(3px); }
Comments
Post a Comment