Daniel Daniel - 9 months ago 64
CSS Question

prevent bootstrap conflict in a child element

I'm using bootstrap for most of the page, but I'd like to use custom css in a

to get a nicer looking table, but the bootstrap css is affecting some of the styles.

I'd like to reset all the styles for a specific div and it's children.

Are there any ways of dealing with this other than explicitly overloading every style bootstrap uses?


To reset all the styles for a specific div, you can add the 'all: unset;' CSS property.

<div style="all: unset;">...</div>

This will undo ("unset") all the styles currently applied to that div (but not it's children), leaving you to add which ever ones you desire.

See it in action here (including how to apply to all child elements):


This is a bootstrap accordion that has been "unstyled".

View browser support here: http://caniuse.com/#feat=css-unset-value

Unsurprisingly this doesn't work in IE.