[web] CSS - how to disable white space removal?

Started by
5 comments, last by spock 18 years, 8 months ago
Hi, I've got one simple question. I know that when there is more than one space in HTML file, they all are removed and only one is left. I'd like to know, is it possible to disable this feature for one tag? I want to create "code" tag, text appearing inside it should be monospaced, inside border etc.:

.sdl_cfg_code
{
    BORDER-RIGHT: gray 1px solid;
    BORDER-TOP: gray 1px solid;
    BORDER-LEFT: gray 1px solid;
    BORDER-BOTTOM: gray 1px solid;
    MARGIN-TOP: 0;
    MARGIN-LEFT: 5;
    MARGIN-RIGHT: 5;
    MARGIN-BOTTOM: 5;
    PADDING: 5 5 5 5;
    DISPLAY: block;

    color: blue;
    
    font-size: 10pt;
    font-family: "Courier New", Courier, monospace;
}

Is there any other property that can help me? I know of & nbsp; hack, but it's irritating to write sth like this:

   [Video]

       screen_size_x = 640
       screen_size_y = 480

       color_depth = 32   

while I could (theoretically) write sth like this:

<pre class="sdl_cfg_code">
 [Video]

 screen_size_x = 640
 screen_size_y = 480

 color_depth = 32   
</pre>


Thx for your help!
Advertisement
You can do that with white-space : pre;
Unfortunately whitespace:pre is one of the many things IE doesn't support.

I don't understand why you don't just use the PRE tag. I think it does exactly what you want.

Quote:
I don't understand why you don't just use the PRE tag. I think it does exactly what you want.


I also don't understand why I have forgotten about this one :-/ Thanks! :-)
Quote:
...
BORDER-LEFT: gray 1px solid;
BORDER-BOTTOM: gray 1px solid;
MARGIN-TOP: 0;
MARGIN-LEFT: 5;
MARGIN-RIGHT: 5;
MARGIN-BOTTOM: 5;
...

Also, CSS property names are lower case, and you need to specify units.

Handy tip: you can also specify margins as:
margin: <top> <right> <bottom> <left>;

For example:
margin: 0px 5px 5px 5px;
Free Mac Mini (I know, I'm a tool)
Thanks for info, I took that CSS from PHP-Fusion. It looks like Firefox is case-insensitive, but other web browsers may not be, so I'll change that.

++rating for everyone who helped :-)
CSS property names should be case-insensitive according to the spec (although almost everyone uses lower-case).

This topic is closed to new replies.

Advertisement