Alex Carpenter Posted on Mar 14, 2018 How to break elements outside of their container with CSS #css #howto View the source files on Github. Top comments (2) Subscribe Personal Trusted User Create template Templates let you quickly answer FAQs or store snippets for re-use. Submit Preview Dismiss Collapse Expand Comment deleted Collapse Expand Alex Carpenter Alex Carpenter Alex Carpenter Follow I am a self taught developer that works best when floating in between design and engineering teams. I enjoy sharing what I know via short instructional screencasts and the occasional written post. Location Grand Rapids, MI Work UI Engineer Joined Dec 13, 2017 • Mar 14 '18 • Edited on Mar 14 • Edited Dropdown menu Copy link Hide Hey Gilvando, not sure I follow your question exactly, does this make sense below? CSS: // These styles will only be applied to the child elements // not the grandchild .c-article__content > * { margin-right: auto; margin-left: auto; } Markup: <div class="c-article__content"> <p>...</p> <!-- child --> <p>...</p> <!-- child --> <figure> <!-- child --> <img src="" alt=""> <!-- grandchild --> </figure> <p>...</p> <!-- child --> <blockquote> <!-- child --> <p>...</p> <!-- grandchild --> </blockquote> <p>...</p> <!-- child --> <p>...</p> <!-- child --> </div> Code of Conduct • Report abuse Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse
Top comments (2)
Hey Gilvando, not sure I follow your question exactly, does this make sense below?
CSS:
Markup: