I am trying to make something like this text box that has a colored background (gray around my code in this example) in Google Docs.

I would like to put some gray box around my code
without any whitespacing - like this!

But it makes me a white spacing between every line. Is there any solution or plugin for this?

1 Answer 1


Short answer

Use a single cell table and set the cell background to gray.


  1. Place the insertion cursor in the location of your document
  2. Click on Table > Insert Table > 1 x 1
  3. Click on Table > Table properties Table properties
  4. Set the line size to 0
  5. Set the background color of the cell
  6. Click on the OK button.
  7. Add the text to the table

Your Answer

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

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