header .hero-image { position: relative; } header .hero-image img { transition: 300ms; } header .hero-image img:hover { transform: rotate(-6deg); }
header .hero-image {position: relative;}header .hero-image img {transition: 300ms;}header .hero-image img:hover {transform: rotate(-6deg);}
下面可以选择最后一个元素：.nav-items li:nth-last-of-type(1) { margin: 0; } 下面可以选择第一个元素：.social-icons a:nth-of-type(1) { margin-left: 0; }
重点：a 标签必须有display: inline-block; transition: 300ms;a:hover使用transform: translateY(-8px);header a { font-size: 24px; color: #FFFFFA; text-decoration: none; width: 240px; height: 60px; background: #01847F; border-radius: 8px; padding: 12px 48px; display: inline-block; transition: 300ms; text-align: center; line-height: 30px; } header a:hover { transform: translateY(-8px); }