I'm why is that and if there is any to that in CSS? It seems like CSS bug to me - first can be also last .
It's not a bug. It's how the works: if an is both the first child and the last child, then if you have :first-child and :last-child in rules and they both match the same , then in the later or more rule will the other.
You can find an of this here,with the -css a last child CSS first-child and last, and that using the of the ,as well as a rule using one of the ...
I'm for like: "first child is also last child" . Does it exist?
css a last child, you would chain both - like this,which works fine:
:first-child:last-child
<p>![last-child_css a last child_css last child][3]
</p>
there a -class that acts the same way:
:only-child
The main (in factcss a last child, the only ) these two is : the first one is more as it one -class. There is no even in , as :last-child and :only-child are both by the exact same of each .
文章来源:https://stackoverflow.com/questions/12093836/css-first-child-and-last-child-dont-work-when-used-on-the-same-element