[TW5] - Problems with persisting styles

154 views
Skip to first unread message

Ton Gerner

unread,
Sep 27, 2013, 11:53:41 AM9/27/13
to tiddl...@googlegroups.com
Hi TW5 enthousiasts,

Playing around with styles in TW5 I added some styles to a tiddler StyleSheetExtra with tag '$:/tags/stylesheet'.
When clicked 'Done' the styles were applied. But, after a reload of the TW the applied styles disappeared.
After opening/closing (edit/done) the StyleSheetExtra tiddler the styles were applied again.
I tried adding StyleSheetExtra to DefaultTiddlers to no avail.

Am I missing something?

Cheers,

Ton

David Gifford

unread,
Sep 27, 2013, 12:25:00 PM9/27/13
to tiddl...@googlegroups.com
Add the words html body before each CSS element in your Stylesheet. Feel free to see the Stylesheet I use as an example here http://giffmex.org/recursosgiffmex.htm.

My Stylesheet is a system tiddler and can be found in the "system" tab within the "more" tab.

Blessings

Dave

Ton Gerner

unread,
Sep 27, 2013, 1:38:40 PM9/27/13
to tiddl...@googlegroups.com
Hi Dave,

Thanks, it works!

On further inspection I found that some definitions in my StyleSheetExtra tiddler did not need html in front of it but others did.

body { font-family:serif; "Times Roman"; }

did not need html in front to persist, but

body { background-color:lavender; }

body { color: blue; }

both did not persist without html in front of it.

Anyhow, I'll have a better look at your StylSheet to learn more.

Thanks a lot,

Cheers,

Ton

Ton Gerner

unread,
Sep 28, 2013, 5:30:02 AM9/28/13
to tiddl...@googlegroups.com
Hi Dave,

Looking at your StyleSheet solved also problems I had styling my tables in TW5.

Thank you again.


Cheers,

Ton

On Friday, September 27, 2013 6:25:00 PM UTC+2, David Gifford wrote:

Tobias Beer

unread,
Sep 28, 2013, 7:14:22 AM9/28/13
to tiddl...@googlegroups.com

Add the words html body before each CSS element in your Stylesheet. Feel free to see the Stylesheet I use as an example here http://giffmex.org/recursosgiffmex.htm.

I wonder why that is. @Jeremy, did you have a reason to bind the styles for basic elements at this level? Are there any <a> or <div> or what-nots outside the body or html container that need not be styled?

- tobias

Jeremy Ruston

unread,
Sep 28, 2013, 8:33:58 AM9/28/13
to TiddlyWiki
The problem is that stylesheets generated from the stylesheet tiddlers are being added to the DOM in the wrong order, with the base stylesheet going last. That means that rules from the base stylesheet can only be overridden with rules of higher specificity. Adding the html and/or body elements is a simple hack to give the rule great specificity.

Best wishes

Jeremy


--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/groups/opt_out.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

Tobias Beer

unread,
Sep 28, 2013, 5:21:35 PM9/28/13
to tiddl...@googlegroups.com, jeremy...@gmail.com

The problem is that stylesheets generated from the stylesheet tiddlers are being added to the DOM in the wrong order, with the base stylesheet going last. That means that rules from the base stylesheet can only be overridden with rules of higher specificity. Adding the html and/or body elements is a simple hack to give the rule great specificity.

I think "hack" is the thing I want to emphasise. Getting the css right is hard enough as it is and so I hope this is a temporary condition which wont last for long. There needs to be a simple way — preferably *one* spot — for defining the exact order of execution. Surely, the base needs to run *first*.

Although poorly manageable (since you need to edit the actual StyleSheet tiddlers), getRecursiveTiddlerText() from TWC provides some more specificity in terms of execution order, even modular nesting.

I guess eventually some sorting of the tagging order of those stylesheet tiddlers and the convention that base + theme run first will be the solution.

Tobias.

Jeremy Ruston

unread,
Sep 29, 2013, 6:14:12 AM9/29/13
to Tobias Beer, TiddlyWiki
Hi Tobias,

Yes, the problems with stylesheet ordering are temporary, and will go away soon,

Best wishes

Jeremy
Reply all
Reply to author
Forward
0 new messages