On Thursday, December 26, 2019 at 10:50:35 AM UTC-8, David Allen wrote:
>
> How do I style a div so that its width as well as its left and right 
> margins are set by variables?
> <$set name="span_percent" value="50">
> <div style="????????">
>
> </div>
> </$set>
>

You want to use a macro to construct the style definition.  Something like 
this:

\define setWidth() 
width:$(width)$;margin-left:$(margin_left)$;margin-right:$(margin_right)$;

<$vars width="50%" margin_left="25%" margin_right="25%">
<div style=<<setWidth>>
   content goes here
</div>
</$vars>

notes:
* $vars does the same thing as $set but supports setting multiple variables 
in the same widget
* I used a "one line macro", which includes the name and definition all on 
the same line, and thus doesn't need a \end
* I include the "%" symbol in the variable values so that the macro can be 
used with other type of measurements, e.g.:
<$vars width="20em" margin_left="10em" margin_right="auto">

enjoy,
-e
Eric Shulman
InsideTiddlyWiki - http://www.TiddlyTools.com/InsideTW

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/9006ae9e-56ce-4ecb-888a-3721373e2366%40googlegroups.com.

Reply via email to