Advertisement
Adelebp

CSS sélecteurs et propriétés

Feb 19th, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. /*HTML*/
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <title>Catch'em all!</title>
  7. <link rel="stylesheet" href="style.css">
  8. </head>
  9. <body>
  10. <main>
  11. <img class="hover-effect" src="http://images.innoveduc.fr/integration_parcours/css/css_selectors_props/hobbit-house.jpg" alt="Hobbit house">
  12. <p>Photo by conner Bowe on Unsplash</p>
  13. <img class="hover-effect" src="http://images.innoveduc.fr/integration_parcours/css/css_selectors_props/hobbit-house-grass.jpg" alt="Hobbit house with grass">
  14. <p>Photo by Jeff Finley on Unsplash</p>
  15. <img class="hover-effect" src="http://images.innoveduc.fr/integration_parcours/css/css_selectors_props/hobbit-house-grey-grass.jpg" alt="Hobbit house with grey grass">
  16. <p>Photo by Tyler Lastovich on Unsplash</p>
  17. </main>
  18. </body>
  19. </html>
  20.  
  21. /*CSS*/
  22.  
  23. body {
  24. font-family: 'Courier New', Courier, monospace;
  25. }
  26.  
  27. /* English : Replace the dots below by a selector targeting all the images of the page. */
  28. /* Français : Remplace les points ci-dessous par un sélecteur ciblant toutes les images de la page. */
  29.  
  30. img {
  31. width: 300px;
  32. height: 300px;
  33.  
  34. /* English : Replace with a property that makes the image borders look rounded. */
  35. /* Français : Remplace par une propriété arrondissant les angles de l'image. */
  36. border-radius: 10px;
  37. }
  38.  
  39. /* English : Replace the dots below by a class named "hover-effect" with a :hover pseudo-class. This class has to target the first image and the last image of the page. */
  40. /* Français : Remplace les points ci-dessous par une classe "hover-effect" avec une pseudo-classe :hover. Cette classe doit cibler la première image et la troisième image de la page. */
  41.  
  42. .hover-effect:nth-of-type(odd):hover{
  43. /* English : Replace with a property responsible for opacity changes. */
  44. /* Français : Remplace par une propriété modifiant l'opacité. */
  45. opacity : 0.8;
  46. cursor: pointer;
  47. }
  48.  
  49. /* English : Replace the dots below by a selector targeting the second image of the page. Do not use a class or an id! */
  50. /* Français : Remplace les points ci-dessous par un sélecteur ciblant la seconde image de la page. N'utilise pas de classe ou d'id ! */
  51.  
  52. img:nth-of-type(2) {
  53. /* English : Replace with a property that makes the image look black & white. */
  54. /* Français : Remplace par une propriété faisant paraître l'image en noir et blanc. */
  55. filter:grayscale(100%);
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement