Forum Moderators: not2easy

Message Too Old, No Replies

I downloaded my CSS files from my host and now they look like a mess!

         

Makaveli2007

12:52 am on Dec 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I decided to change my CSS codes on my hosting account and then download them on my pc (and overwriting(exp?) the old file I had on my PC).

The site is still displayed correctly however the code is basically crammed without any spaces in between all the elements. It's usually the type of CSS code I see when I look up the code of other peoples' sites.

Is there any way to make this undone or will I just have to use this code, now and make sure I never do this again?

Marcia

1:04 am on Dec 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>code is basically crammed without any spaces in between all the elements. It's usually the type of CSS code I see when I look up the code of other peoples' sites.

What browser are you viewing them in, and which software of yours is displaying them if they're all mashed together like that?

Suggestion: always, always, always make dated backup copies of css, htaccess and other files ON the server and on your machine so they can be reverted back to at any time just with a simple filename change. Like style_before_16dec07.css

And when using a revised one, try a test file on a test page using something like style_test.css and page_test.html before letting it go live on a live site.

I've had Notepad do what you're seeing in the past. I've started to use Notetab Light (free) for .php (includes) and css files, as well as for trimming html file sizes, since it has HTML Tidy integrated as well as havig features that strip excess white space, etc. Then I re-do a bit by hand if needed, so formatting is exactly how I want it.

penders

4:14 pm on Dec 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It sounds as if you might have downloaded your CSS files in binary transfer mode (as opposed to ASCII) from a Linux hosted website to Windows (or Mac) locally...?

Since Linux uses "\n" (linefeed) for line endings and Windows uses "\r\n" (carriage return + linefeed), if you transfer in binary mode these line endings will be preserved and depending on the application you use, your line endings could be lost. If you transfer in ASCII mode, the line endings are converted.

Conversely, if you upload from Windows to Linux in binary mode you can end up with your code being double line spaced.

This may not be too much of an issue with CSS files, as it may still work, but if you are uploading code (PHP, Perl) that depends on newlines in heredoc strings perhaps then it's critical!

...the code is basically crammed without any spaces in between all the elements.

'Spaces' as well?! Although it's possible with CSS that the only 'spaces' are in fact the newlines?

Is there any way to make this undone...

Download in ASCII mode?

...make sure I never do this again?

If it is an issue with FTP transfer mode, then if you transfer in 'Auto' mode (ie. the FTP software chooses whether to use ASCII or Binary mode depending on file type) then make sure it uses ASCII mode for .css and .htm files etc.

londrum

8:47 pm on Dec 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



you could give this a go... have you got MS Word?
open the file up in MS Word and then do a 'find and replace' to insert new line breaks.

choose 'Replace' in the 'Edit' menu, and put

}

in the 'Find what' box, and
}^l

in the 'Replace with' box

the

^l
is what stands for a line break.
you can insert tabs too, with
^t