9
I’m creating a CSS that simulates cards from a deck, with cards and card hands. When a one-hand card is selected it is highlighted above the others.
This works well, but I would like to apply a transition effect to when the letter is highlighted. I tried in some ways unsuccessfully.
Follow the code below:
HTML:
<body>
    <br /><br />
    <div class="hand">
        <div class="card"></div>
        <div class="card"></div>
        <div class="card"></div>
        <div class="card"></div>
    </div>
</body>
CSS:
.card {
    width: 140px;
    height: 190px;
    border: 1px solid #aaa;
    border-radius: 7px;
    box-shadow: 0px 0px 2px 0px rgba(50, 50, 50, 0.75);
    background: white;
}
.hand {
    position: relative;
}
.hand .card {
    position: absolute;
    transition: top .5s;
}
.hand .card:hover, .hand .card.selected {
    top: -2em;
}
.hand .card:nth-child(1)  { left: 1.1em; }
.hand .card:nth-child(2)  { left: 2.2em; }
.hand .card:nth-child(3)  { left: 3.3em; }
.hand .card:nth-child(4)  { left: 4.4em; }
.hand .card:nth-child(5)  { left: 5.5em; }
.hand .card:nth-child(6)  { left: 6.6em; }
.hand .card:nth-child(7)  { left: 7.7em; }
.hand .card:nth-child(8)  { left: 8.8em; }
.hand .card:nth-child(9)  { left: 9.9em; }
Link to the sample on Jsfiddle
That model would be OK. What I need is for Transition to work with the top, so that instead of the jumping card, it displays an effect, a smoother transition.
How about you flip the card? http://desandro.github.io/3dtransforms/docs/card-flip.html
– Bruno Rozendo
@Brunorozendo My model would be OK, only what I need is for Transition to work with the top, so instead of the card to jump is displayed a softer effect.
– iuristona