最佳答案
你只能通过组合:first-child和:nth-last-child()来实现这一点,这意味着在纯CSS中你将得不到比IE9及更高版本更好的支持:
p:first-child:nth-last-child(2) {
display: none;
}
如果你想要在它有兄弟姐妹的时候隐藏第一个p(也就是说总共有2个,3个,4个孩子并不重要),请改用:
p:first-child:not(:only-child) {
display: none;
}
最佳答案
你只能通过组合:first-child和:nth-last-child()来实现这一点,这意味着在纯CSS中你将得不到比IE9及更高版本更好的支持:
p:first-child:nth-last-child(2) {
display: none;
}
如果你想要在它有兄弟姐妹的时候隐藏第一个p(也就是说总共有2个,3个,4个孩子并不重要),请改用:
p:first-child:not(:only-child) {
display: none;
}
猜你在找的CSS相关文章