Adding float:right to ximg macro?

Hi all, I routinely use Tobias Beer’s ximg macro to define a global path for external images. However I have spent way too long today trying to write a new version (ximgR and ximgL, for example) to get text to wrap around the image by using float:right and float:left styles. I’m sure it is dead simple and another macro using CSS classes should be sufficient but i need my hand held even more: I can’t find legal syntax to implement the CSS classes within ximg.

for example this doesn’t work

\define imageR(img:"", float="". width:"", align:"", caption:"", title:"", text:"", footer:"", pos:"", alt:"")
<$vars path="https://some.image.server/project_images/">
<$macrocall $name=image-right 
img={{{[[$img$]addprefix<path>] }}}
float="right; margin: 0px 0px 15px 15px;"
width="$width$"
align="$align$"
title="$title$"
text="$text$"
footer="$footer$"/>
</$vars>
\end

and nor do the other iterations i tried such as one using

style="float:right; margin: 0px 0px 15px 15px;"

I’d be very grateful for guidance. I note that macros are now becoming superseded by Functions and Widgets; is this the best place for me to start remedial reading or is there an even better resource for how tw uses variables and CSS? https://tiddlywiki.com/static/Macros.html

thanks, Robin

Could you simply define a class in your CSS and use the unaltered macro?

<<ximg toc.jpg class:"right" width:300px tooltip:"example toc">>

In a type: text/css tiddler or a <style> tag:

.right {
  float: right;
  margin: 0px 0px 15px 15px;
}

If you wanted to combine this with other existing classes, just space separate them:

<<ximg toc.jpg class:"pretty right" width:300px tooltip:"example toc">>
<!--                  ^^^^^^ ~~~~~                                  -->
1 Like

Very many thanks! Silly of me - the simple insight was that classes are combined by simply separating them with a space.