V
V
Valera Karmanov2020-05-11 18:49:45
JavaScript
Valera Karmanov, 2020-05-11 18:49:45

How to highlight a new row in a table?

Good evening! Tell me how to highlight a new row in a table. Maybe this is done through css or jquery, but the point is that when a new line appears, its background smoothly changes from white to light blue and back...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Botsman, 2020-05-11
@motokraft

You need to add the following to the css rules:

@keyframes color-me-in {
    0% {
        background: white;
    }
    50% {
        background: blue;
    }
    100% {
        background: white;
    }
}

This is an animation to make an element go from white to blue and then back to white.
Next, to the new line of the table, you need to add a css property with the name of the rule created above: 'div' must be replaced with a selector in your table. To select exactly the last row in a table, you can use the `last-child` pseudo selector:
$('div').css('animation', 'color-me-in 5s')
table tr:last-child {
    animation: color-me-in 5s;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question