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
Apply different styles based on a condition? #311
Comments
I don't think pure css allows selections that are not directly related to each other. For example:
can you apply style on #div2.1 based on attribute of #div1.2? I don't think you can... |
You can't, unless they share an attribute, or descend from parents that share the attribute. The 'parent' selector is omitted, I believe due to the DOM being an directed acyclic graph, which has benefits that outweigh arbitrary traversal selectors. Outside of the scope of pure Stylish... If you are the author, you can apply classes liberally, add attributes closer to A little trick of mine is to bookmark a javascript snippet and click it to apply it to the current page. You need a workaround to get it to work in the FF url bar: instead of Edit -- additional Javascript method:
Create multiple versions of a stylesheet and inject the one you want, either by manually selecting the corresponding bookmarked JS, or by writing the conditional logic in the body of the function. Again, you can tailor the styles or parametrize them and filter them from the script. I tried injecting a |
Hello.
I might be missing something, but is there a way apply different style based on page condition - such as weather browsing as a guest or logged in as a member?
Unfortunately the part of the page that has such information is totally separate from the part I want to change style, therefore pure css is not possible. So I wondered if stylish allows use some kind of conditional tricks for this kind of situation?
Thank you.
P.S.
trying have different style for guests and members in this userstyle:
https://userstyles.org/styles/139743/potplayer-forum-breadcrumbs
The text was updated successfully, but these errors were encountered: