I recently was looking for a CSS solution to vertically-align elements, and I found one here.

One thing that I thought was nice was the right-justified code; example:

.vertical-center {
    // ... other stuff ...

           -webkit-box-pack : center;
              -moz-box-pack : center;
              -ms-flex-pack : center;
    -webkit-justify-content : center;
            justify-content : center;

It looks nice, and is a bit easier to read (in my opinion). However, I prefer tabs, and this kind of formatting requires spaces. That's not the main issue though.

The problem is that it seems to me that code like this becomes unmaintainable because one becomes focused on 'beautifying' the code instead of doing something more productive.

How can this be reconciled, so that code is both easy to read and to write?


This sort of thing can always be done with an IDE. I am not familiar with an IDE that supports this exact formatting, but I know that most modern IDEs have highly customizable settings for formatting code.

As a Java programmer using Eclipse, I have it set so that I can type Ctrl+A(select all) Ctrl+Shift+F(code-format) and it will prettify all my Java code using the settings I've set for my project.

In short, it really doesn't add to your development time, with a proper IDE, and if it makes the code easier to read, go ahead and do it! The worst case would be that you have to write your own extension for your IDE for this particular format, which could be a little bit of a pain.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.