Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styling conflicts with HTML element #33

Closed
jordnz opened this issue Jul 20, 2016 · 8 comments
Closed

Styling conflicts with HTML element #33

jordnz opened this issue Jul 20, 2016 · 8 comments
Labels

Comments

@jordnz
Copy link

jordnz commented Jul 20, 2016

Using custom styled pre tags breaks astrum's pre tag styles, not sure if you can do much about that.

I've added a class to my pre tags and used that as the selector in css, not ideal as it's not how I'll be selecting it in production but it works just as well

@jordnz jordnz changed the title Styling conflicts with standard HTML elements Styling conflicts with HTML element Jul 20, 2016
@RyanHavoc
Copy link
Member

@prolax Could you link us to an example of the issue you're having?

@jordnz
Copy link
Author

jordnz commented Jul 27, 2016

@RyanHavoc I'm using "pre" tags in my component library, but as you can see have had to add a class to the tags so I don't have any styling conflicts with the "pre" tags being used as part of Astrum.

If there was a class added to Astrum's "pre" tags then Astrum could select just those "pre" tags instead of styling the default element.

Hope that makes sense.. :)

pre
example

@RyanHavoc
Copy link
Member

@prolax We've resolved this in the latest release 1.5.15. You shouldn't need to set a class now.

@giuseppeg
Copy link

Hi @RyanHavoc I am considering to give astrum a try but I was wondering how do you folks deal with conflicting css rules?

What happens if my pattern library has something like * { margin: 0 } or other resets?

Is there any chance to sandbox the examples either by loading markup.html in an iframe or using ShadowDOM?

@RyanHavoc
Copy link
Member

Hi @giuseppeg. All Astrum elements are prefixed with '.ndpl-' to avoid conflicting with your project styles. It's generally considered bad practice to use '*' for resetting (for this very reason, you're too easily prone to conflicts and it's not a very efficial way to reset styles), consider using something like normalize.css which targets specific elements rather than using a wildcard.

@giuseppeg
Copy link

@RyanHavoc fair enough, for clarity I know that it is a not recommended practice I just want to bring up one of the many ways to break things even when you use BEM.

Anyway the reason why I asked is because I saw that pages' selectors target elements but now I realised that pages are just for documentation.

Initially I thought that one could display components in pages as well – in fact I would love to be able to prototype pages to show things to product managers, designers etc. I think that it would be fairly easy to add this feature. If you like this idea I would be happy to file a new issue or even implement it.

@RyanHavoc
Copy link
Member

@giuseppeg it would be great if you could create a separate Proposal issue and elaborate on how to envisage this feature working in more detail.

@davidhund
Copy link

One (IMO better) way to fix these style collisions would be to render patterns in an iframe and only load project (not Atrum) CSS there. This would also allow for better Responsivene previewing. See also #71 and #79

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants