How to handle long CSS code in Editor


#1

Hello, so im wondering about how to make the code in an editor no go past 80 characters (which is what I was told is the max any code should be). So for example, let’s say I have this in my code:

src: url(“http://www.Thisisjustatesttoshowyouhowlongsomeofmythingsarebecomingandtoseewhattodo”)

for me this is going past 80 characters and so what I did was this:

src: url(“http://www.Thisisjustatesttoshowyouhowlongsomeofmythings
arebecomingandtoseewhattodo”);

will this work? I know using \ works in python so thats kind of where I was headed… if this doesn’t work, how do we do it? thanks!


#2

The continuaton operator is the recognized approach. It can be inside the quotes on a string assignment, and outside of quotes in print statement, but must be the last character on the line.

    s = "long sentence \
 more to add to this \
 long sentence"
    print ("long sentence" \
" more to add to this" \
" long sentence")
    long code segment \
 more long code segment \
 more code segment

leading whitespace is preserved on subsequent lines.