Quick $:/tags/Stylesheet question

83 views
Skip to first unread message

Ste Wilson

unread,
Nov 3, 2018, 12:32:17 PM11/3/18
to TiddlyWiki
I have the following tddler

$:/Floatleft which contains

img
{
float: left;
}

Tagged as in the title and set as text/css but this seems to apply to all img in the tiddlywiki, not just locally to tiddlers with @@.floatleft in them.

What am I missing?

Thanks.
Ste

Mark S.

unread,
Nov 3, 2018, 2:04:13 PM11/3/18
to TiddlyWiki
Not sure what you mean by "tagged as in the title". The title of the stylesheet tiddler can be anything.

The styles created in the stylesheet  will apply everywhere. In order to make them work only where you want, to have to make the selectors more specific.

So if you've tagged things as "FloatLeft" then your style sheet might need to look like:

[data-tags *="FloatLeft"] img
{
    float: left;
}

The attribute selector used here is fairly new. There was another way to do this in the past. See https://tiddlywiki.com/#Custom%20styles%20by%20data-tags for more details.

I might add that "float: left" seems to be a default, but that's another issue.

Good luck!
-- Mark

Ste Wilson

unread,
Nov 3, 2018, 2:16:01 PM11/3/18
to TiddlyWiki
That's hit the spot.
The title I was referring was the title of the post ;)

Cheers for that.

Ste

Eric Shulman

unread,
Nov 3, 2018, 3:24:01 PM11/3/18
to TiddlyWiki
On Saturday, November 3, 2018 at 9:32:17 AM UTC-7, Ste Wilson wrote:
You need to define a custom CSS class named "floatleft" that has the rule for images within it... like this:

.floatleft img { float:left; }

Then, to apply the floatleft class to a tiddler containing an image, you can write

@@.floatleft [img[...]] @@


enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki: The Missing Manuals



Ste Wilson

unread,
Nov 4, 2018, 2:36:27 AM11/4/18
to TiddlyWiki
Cheers Eric!
I thought there was a way to set up css that only happens on an @@!

Solution implemented.

Reply all
Reply to author
Forward
0 new messages