Is there a way to adjust the width of text within a (code) tag so it always fits within the background? I want the text in the (pre) element to resize along with the background as the browser window resizes.
Please see the pictures below for reference:
This is my current code:
HTML
<pre>
<code>
if (condition) { statement_1_runs_if_condition_is_true;
statement_2_runs_if_condition_is_true; } else {
statement_3_runs_if_condition_is_false;
statement_4_runs_if_condition_is_false; }
</code>
</pre>
CSS
pre {
background-color: #CCC5B9;
border: 1px solid #999;
border-radius: 3px;
display: block;
width: 60%;
margin: 0 0 0 30px;}
code{
color: #252422;
font-size: 14px;
font-family: Consolas;}
Thank you.