https://www.w3schools.com/cssref/sel_nth-of-type.asp
Ejemplo:
<!DOCTYPE html>
<html>
<head>
<style>
tr:nth-child(odd) img {
border:1px solid #000;
float:right;
}
</style>
</head>
<body>
<table>
<tr>
<td>
<img src="https://www.midominio.com/foto.jpg">
Uno
</td>
</tr>
<tr>
<td>
<img src="https://www.midominio.com/foto.jpg">
dos
</td>
</tr>
<tr>
<td>
<img src="https://www.midominio.com/foto.jpg">
tres
</td>
</tr>
</table>
</body>
</html>
Otro ejemplo:
<style>
div:nth-child(even) img {
border:1px solid #000;
float:right;
}
</style>
</head>
<body>
<div>
<img src="https://www.midominio.com/foto.jpg">
Uno
</div>
<div>
<img src="https://www.midominio.com/foto.jpg">
dos
</div>
<div>
<img src="https://www.midominio.com/foto.jpg">
tres
</div>
No hay comentarios:
Publicar un comentario