That is not a box, but some sort of script (I am not a WEB dev)
This is really a EPUB coding question.
(PM me and I can move this thread to EPUB)
You need to use HTML/CSS box model
If it is a 1 liner
Simply
Set some padding for the P tag
This leaves some blank space around the text; Set the background-color: blue; Set the (text) color: white (black on blue has terrible contrast

)