- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
in the above pen
SECTION and ASIDE are children of a DIV, but , “[class*=’grid-‘]:last-of-type ” applies to both of them.
please explain this behaviour..
Perhaps you are thinking of :last-child?
Wait…no, I think I have cracked it….you didn’t specify the element type that the last of type
was to apply to.
If you make it div[class*='grid-']:last-of-type
I think it works.
http://codepen.io/anon/pen/fvome
What you had before was (I think) , effectively last-of-class
and that doesn’t exist.
@paulie…
I have my answer in your reply…
I wanted the last of type
to apply only for last child(in a parent with class name starting with grid-
) with class name that starts with grid-
.
It works fine in following cases
<div class="grid-"></div>
<div class="grid-"></div>
or
<div>
</div>
but it doesn’t work for following
<div>
</div>
as children are of different element types… yes by last-of -type
it is targeting last child of each element type with [class*=’grid-‘], with in a container….
thank you, very much…