Exécuter
❯
Exécuter le code
Ctrl+Alt+R
Enregistrer le code
Ctrl+Alt+A
Changer d'orientation
Ctrl+Alt+O
Changer de thème
Ctrl+Alt+D
<!DOCTYPE html> <html> <head> <style> .image-container { largeur: 100%; hauteur: 400px; bordure: 1px solide noir; } .image-container img { largeur: 50%; hauteur: 100%; object-fit: cover; flottant: gauche; } </style> </head> <body> <h2>Utiliser object-fit</h2> <p>Ici, nous utilisons "object-fit: cover;", donc lorsque nous redimensionnons la fenêtre du navigateur, le rapport d'aspect des images est préservé :</p> <div class="image-container"> <img src="rock600x400.jpg" alt="Norway" width="600" height="400"> <img src="paris.jpg" alt="Paris" width="400" height="300"> </div> </body> </html>