http://www.perlmonks.org?node_id=1015708


in reply to CSS Show and Tell: Colored Code

Today I added max-width to prevent overly wide code snippets causing unwanted scrollbars:

textarea { width: 100%; height: 25em; } table.user-settings, .user-settings textarea { width: 100%; } div.pmsig, div.footer, tr.bannerrow { display: none; } p, li { text-align: justify; } body#id-11911 .nodelets { display: none; } body#id-3333 .nodelets { display: none; } div#nnt-section-Users { display: none; } a[href="?node_id=961"], a[href="?node=Anonymous%20Monk"] { color: #c000a0; } tt.codetext, tt.inlinecode { border: 1px solid gray; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; font-family: "DejaVu Sans Mono", LettrGothic12BT, "Lucida Console", + mono, monospace; white-space: pre; color: black; background-color: #fffff4; max-width: 1000px; word-wrap: break-word; } tt.codetext { display: block; margin-right: 5px; padding: 4px 4px 4px 4px; font-size: 100%; line-height: 13px; } tt.inlinecode { padding: 2px 1px 2px 1px; font-size: 60%; line-height: 15px; }

Enjoy, Have FUN! H.Merijn