Style Question - Double Space?

Should html be double spaced within the code? How do I know what to put in as single spaced lines and when to make a double space? I read the google html style guide, and I didn’t see this topic covered.

(I know that it won’t affect the code, but I want to know the conventional style so that my code doesn’t look ridiculous to anyone evaluating it).

For the most part, you’re probably fine with the defaults. If you aren’t changing things like the line height or using a weird font, you’re safe using the standard conventions.

Thank you. When you say “defaults,” do you mean that certain lines will be single or double spaced by default? Does this depend on the IDE I’m using? Sorry, I’m a beginner.

I thought that you were talking about the way that the text appears on your website. If you’re talking about the way the code itself looks, then you can adjust your IDE settings to make the text whatever size and spacing is easiest for you to read and no one will ever know or care. You won’t insert a blank line in between every line of code, but you may often use a blank line or two to break your code into sections and make it easier to read.

Yeah, thanks. That’s more what I’m asking. I heard that code readability is important in the workplace (for example adding comments), so I wasn’t sure if there were standards around when to insert a blank line to break my code into sections.

There’s no hard and fast rule. You use your own experience with what makes it more intuitive to your eyes and brain.

1 Like

A space between every

single line with content

can decrease readability,

but I will often group
my code into chucks that go together
with an extra line between the chunks;

but it really depends upon what is common
in whatever codebase you are working on
and with whatever team members you have.

1 Like


you very much. That

helps. :grin:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.