WordPress.org

Forums

CSS space question (6 posts)

  1. Julian
    Member
    Posted 2 years ago #

    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.

  2. Mario Peshev
    Member
    Posted 2 years ago #

    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.

  3. Andrew
    Forum moderator
    Posted 2 years ago #

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

  4. Julian
    Member
    Posted 2 years ago #

    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.

  5. s_ha_dum
    Member
    Posted 2 years ago #

    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.

  6. Julian
    Member
    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.