Ask HN: Where does one find modular CSS components?
阿新 • • 發佈:2018-12-28
Codepen, and many other sites like it, have beautiful demos of working components. However those components are seldom portable because Codepen imposes no constraints on styling rules. The rendered document is served in a distinct iframe, and authors are allowed to style whatever global attributes they wish. So using an attractive, striped accordion table someone else made is rarely trivial since the styling rules aren't scoped to a container; the "container" is the html and/or body of the document, so you have to be willing to either manually fine-tune the document's css selectors (i.e., scope them to a block-level component) or render the component in an iframe (which no one wants to do).