diff --git a/packages/block-library/src/code/style.scss b/packages/block-library/src/code/style.scss index e8d3b07cd034fa..670a4f7f1ef4c8 100644 --- a/packages/block-library/src/code/style.scss +++ b/packages/block-library/src/code/style.scss @@ -1,8 +1,13 @@ -// Provide a minimum of overflow handling and ensure the code markup inherits -// the font-family set on pre. -.wp-block-code code { - display: block; - font-family: inherit; - overflow-wrap: break-word; - white-space: pre-wrap; +.wp-block-code { + // This block has customizable padding, border-box makes that more predictable. + box-sizing: border-box; + + // Provide a minimum of overflow handling and ensure the code markup inherits + // the font-family set on pre. + code { + display: block; + font-family: inherit; + overflow-wrap: break-word; + white-space: pre-wrap; + } }