Change styling when add new sibling in pure CSS
I have a container with children:
<div id="container">
<div></div>
<div></div>
<div></div>
</div>
Sometimes I want to add another child (server-side) into the container and
change the styling of the other children to make room for their new
sibling. It would become:
<div id="container">
<div id="special"></div>
<div></div>
<div></div>
<div></div>
</div>
Can I achieve this purely in CSS? Are there fancy new selectors (CSS4?)
that I can use?
I want to avoid JavaScript or changing the attributes (classes) of any of
the elements. I did read about the lack of parent selectors in CSS but the
articles I read are a couple of years old, so I suspect there might be
some brand new selectors I can take advantage of.
No comments:
Post a Comment