• This might be something minor but I am somewhat picky in having consistent code. I’ve started getting into making child themes recently and on at least two of them have written some of my CSS like this with no space after the colon.

    display:none;

    On the other hand I have written some I think with a space after the colon. So I have at least two child themes with inconsistent CSS. I realize that it is just personal preference for the space to make the code more neat but if I go back and add spaces to the end of all of the colons will this add much to the size of the CSS file and increase the page load time? I want to make it as easy as possible if/when it is necessary to modify the CSS again. Thanks for your suggestions.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Except for personal preferences, it doesn’t really matter. It would work the same way and the extra space is about 1 byte of physical memory diff.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    This is not a WordPress issue, try a CSS forum.

    Thread Starter Julian

    (@jm300)

    Thanks! Thought it could be a WordPress question since I am making child themes and want to use the best practices possible. Apologies if it isn’t relevant.

    It doesn’t matter as far as functionality but you end up with a smaller file size without the space.

    ‘Best practices’ would be to write neat readable CSS however you like and then push it through something like YUI Compressor for deployment. I don’t know what specific compressor they use but that is what WordPress does with its CSS. That is why you have both ‘wp-admin/css/wp-admin.dev.css’ and ‘wp-admin/css/wp-admin.css’. The former is the readable, uncompressed version.

    Thread Starter Julian

    (@jm300)

    Great! Thanks! Learning so much. I’ll have to see what the size would be with the spaces.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘CSS space question’ is closed to new replies.