I realized that if you put the length here:
attach boxed title to top left={yshift=<length>}
in pt, mm or cm, the title box is shifted.
If you put it in ex or em, it is not.
Is it a tcolorbox bug?
\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{mwe}
\begin{document}
\begin{tcolorbox}[title=My title,
enhanced,
attach boxed title to top left={yshift=-40pt},
]
With \texttt{pt} (or \texttt{mm}, or \texttt{cm}) the positioning works
\end{tcolorbox}
\vspace{30pt}
\begin{tcolorbox}[title=My title,
enhanced,
attach boxed title to top left={yshift=-4ex},
]
With \texttt{ex} (or \texttt{em}) it doesn't work
\end{tcolorbox}
\end{document}


\pgf@picture. Patching it to remove the\nullfontmakes theyshiftwork, but there is extra horizontal shift (of the whole thing and even more of the title) presumably from space tokens. – May 01 '18 at 10:120pt, but why does it normally work intikz? – CarLaTeX May 01 '18 at 10:13xxx \tikz{\coordinate(a) at (0,0);\draw[green] ([yshift=4mm]a)--++(2,0);\draw[red] ([yshift=4em]a)--++(2,0);}. It works inside nodes as there a font is active. – Ulrike Fischer May 01 '18 at 11:46