# CODE directive, single-lined?

**URL:** <https://boards.straightdope.com/t/code-directive-single-lined/50418>\
**Category:** About This Message Board\
**Created:** [January 17, 2001, 12:23am UTC](https://boards.straightdope.com/t/code-directive-single-lined/50418 "2001-01-17T00:23:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tracer](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tracer/32/20578_2.png) [@tracer](https://boards.straightdope.com/u/tracer)\
**Post date:** [January 17, 2001, 12:23am UTC](https://boards.straightdope.com/t/code-directive-single-lined/50418/1 "2001-01-17T00:23:51Z")

</div>

I thought I’d asked this question before, but I can’t find it when I search this Forum, so I guess I DIDN’T ask this question before.

To wit:

When I use the {CODE} vB command (using square brackets instead of curly braces, of course), everything between it and the following {/CODE} command is DOUBLE SPACED, i.e. with a blank line between each line, like this:

```auto

line 1
line 2
line 3

```

Is there a way to make the CODE command display things as SINGLE spaced, without the blank line in between each entry? It would be VERY useful for doing ASCII-art diagrams of organic chemicals.

---

<div class="post-metadata">

**Author:** ![Show\_Biz](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@Show\_Biz](https://boards.straightdope.com/u/Show_Biz)\
**Post date:** [January 18, 2001, 8:55pm UTC](https://boards.straightdope.com/t/code-directive-single-lined/50418/2 "2001-01-18T20:55:51Z")

</div>

Your post is single spaced on my screen.  
I’m using IE5.5 on a 1024x768 setting.

Anyone else see double spacing there? What are you running?

---

<div class="post-metadata">

**Author:** ![Lord\_Jim](https://avatars.discourse-cdn.com/v4/letter/l/ecccb3/32.png) [@Lord\_Jim](https://boards.straightdope.com/u/Lord_Jim)\
**Post date:** [January 18, 2001, 10:00pm UTC](https://boards.straightdope.com/t/code-directive-single-lined/50418/3 "2001-01-18T22:00:37Z")

</div>

Yes, I see the extra blanks lines. The problem is a combination of the way vB translates [**code][**/code] tags into \<pre\>,\</pre\> (preformatted text) tags. Instead of accepting the data as type, vB adds a \<br\> tag between each line. When Netscape lays out the page, it see the carriage return at the end of the line as one line break and the \<br\> as a 2nd one. When IE lays it out, it ignores the \<br\> tag completely.

Which is “right”, I don’t know. They both execute \<font\> tag inside the \<pre\> tags, but only Netscape executes the \<br\> tag.

Really, though, the \<br\> tag shouldn’t be there in the first place. I don’t think Jelsoft (makers of vBulletin) even bothers to check their code with Netscape.

Jim

---

<div class="post-metadata">

**Author:** ![mblackwell](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@mblackwell](https://boards.straightdope.com/u/mblackwell)\
**Post date:** [January 18, 2001, 10:03pm UTC](https://boards.straightdope.com/t/code-directive-single-lined/50418/4 "2001-01-18T22:03:46Z")

</div>

I am also using IE 5.5 on 1024x768. It is double spaced for me.

---

<div class="post-metadata">

**Author:** ![Lord\_Jim](https://avatars.discourse-cdn.com/v4/letter/l/ecccb3/32.png) [@Lord\_Jim](https://boards.straightdope.com/u/Lord_Jim)\
**Post date:** [January 18, 2001, 10:49pm UTC](https://boards.straightdope.com/t/code-directive-single-lined/50418/5 "2001-01-18T22:49:03Z")

</div>

That’s interesting. I have Netscape 4.74 and IE 5.0 and Netscape is double spaced and IE is single spaced, no matter what screen resolution I use.

Wonder what the different is.

Jim

---

<div class="post-metadata">

**Author:** ![tracer](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tracer/32/20578_2.png) [@tracer](https://boards.straightdope.com/u/tracer)\
**Post date:** [January 22, 2001, 2:18am UTC](https://boards.straightdope.com/t/code-directive-single-lined/50418/6 "2001-01-22T02:18:21Z")

</div>

I, too, am running Netscape 4.7, and it’s double-spaced for me.  
I’ve also noticed the following anomaly in Netscape 4.7:

If I post a {/b} or a {/i} directive that doesn’t come after a corresponding {b} or {i}, Netscape 4.7 displays the rest of the message in a Times Roman font, but IE 5.x keeps using the same (sans sarif) font that the rest of the message was in. Viz:

This sentence is in the normal font.  
\*In a Netscape browser, this sentence is in Times Roman.

---

<div class="post-metadata">

**Author:** ![tracer](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tracer/32/20578_2.png) [@tracer](https://boards.straightdope.com/u/tracer)\
**Post date:** [January 22, 2001, 2:23am UTC](https://boards.straightdope.com/t/code-directive-single-lined/50418/7 "2001-01-22T02:23:36Z")

</div>

I just looked at the HTML generated by the {CODE} directive, and I think I know why it’s appearing double-spaced in my browser.

The HTML looks like this:

\<pre\>  
line 1  
\<br\>  
line 2  
\<br\>  
line 3  
\</pre\>

Those \<br\> tags should not be there. Everything between the \<pre\> and \</pre\> tags is automatically displayed exactly as it’s written, with separate lines preserved. \<br\> within a \<pre\> block is totally unnecessary.
