Jump to content
  • Advertisement
Sign in to follow this  
Koshmaar

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

This topic is 4848 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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! :-)

Share this post


Link to post
Share on other sites
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;

Share this post


Link to post
Share on other sites
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 :-)

Share this post


Link to post
Share on other sites
CSS property names should be case-insensitive according to the spec (although almost everyone uses lower-case).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!