I have the following HTML:
<h2>Embed Code</h2>
<pre>
<code>
<script type="text/javascript">
var something = 'else';
</script>
</code>
</pre>
And the following CSS:
h2 {
background:#1e7ca2;
font-weight: 100;
font-size: 1.25em;
padding: 10px 15px;
margin: 0;
color: white;
}
pre {
margin:0;
padding:0;
}
code {
margin: 0;
padding: 0 30px;
display: block;
background: #1d1f20;
color: #839496;
font-size: .85em;
line-height: 1.6em;
}
But there's a gap between the h2
and the pre
element that I can't seem to get rid of.
You can see the problem in action here: http://jsfiddle.net/gaby/k5V8U/
What ever is inside <pre>
preserves the whitespace as well..
If you remove the whitespace between <pre>
and <code>
like this
<pre><code>
and
</code></pre>
it gets fixed..
Demo at http://jsfiddle.net/gaby/k5V8U/1/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With