2
$\begingroup$

When highlighting text using Style and Background, as in Style["Test ", White, Background -> Lighter@Blue] is there a way to pad (ie, enlarge) the bounding box?

The bottom of the background seems coincident with the base of the text: here

$\endgroup$

2 Answers 2

3
$\begingroup$
Style[Pane[" Test "], White, Background -> Lighter@Blue]

enter image description here

Edit

Controlling the padding:

Style[Pane[" Test ", ImageMargins -> 10], White,  Background -> Lighter@Blue]
$\endgroup$
3
  • $\begingroup$ Ok that works. But is there no way to parametrically control size? (Other than rendering an independent Rectangle) $\endgroup$ Jul 21, 2012 at 19:22
  • 1
    $\begingroup$ @alancalvitti Add that request to the question. I tried to answer it in its current state $\endgroup$ Jul 21, 2012 at 19:23
  • $\begingroup$ @alancalvitti See edit $\endgroup$ Jul 21, 2012 at 19:25
3
$\begingroup$

You could play with the FrameMargins ...

Framed[Style["Test", White], FrameStyle -> None, FrameMargins -> 2, 
 Background -> Lighter@Blue] 

test

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.