如何在不影響帖子內部任何其他圖像的情況下如何調整CSS中的第一個圖像。如果我使用以下代碼:使用CSS調整文章中的第一個圖像,而不會影響任何其他圖像
#content div.single:nth-of-type(n) img {
width: 448px !important;
height: 252px !important;
padding: 0 !important;
margin-top: 0;
它調整了帖子內所有圖像的大小。
我也曾嘗試第n個孩子,但沒有成功:
#content div.single img:nth-child(1){
width: 448px !important;
height: 252px !important;
padding: 0 !important;
margin-top: 0;}
這裏是the Demo
':first-child'僞選擇器應該可以工作......順便說一句,你在該頁面上每個帖子只有1張圖片,因此你頁面內的所有圖片都會受到影響 - 如果你的確在瞄準第一張圖片每篇文章......你有沒有想過在頁面上的第一篇文章中的第一個圖像? – zoranc
你想更改GTA標誌嗎? – Siyah