LADYX,
Сообщение от LADYX
|
Регистрация: 19.02.2015
|
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
td > div {
background-image: -webkit-linear-gradient(left, #0000CD, #1E90FF);
background-image: linear-gradient(to right, #0000CD, #1E90FF);
color: #FFFF00;
}
td > span {
background-image: -webkit-linear-gradient(left, #FF1493, #F0E68C);
background-image: linear-gradient(to right, #FF1493, #F0E68C);
color: #FFFFFF;
}
</style>
<script>
document.addEventListener( "DOMContentLoaded" , () => {
document.querySelectorAll("td").forEach((td, i) => {
let el = document.createElement(i % 2 ? "span" : "div");
el.append(td.firstChild);
td.append(el)
})
});
</script>
</head>
<body>
<table>
<tr>
<td>Текст</td>
<td>10</td>
</tr>
<tr>
<td>Текст</td>
<td>20</td>
</tr>
<tr>
<td>Текст</td>
<td>30</td>
</tr>
</table>
</body>
</html>