English (US) spelling needed for coding?

Hi all! I’m brand new to coding, looking for a career change into data analytics and trying to get a headstart on the course I’m starting next year.

I just had trouble passing the first CSS test as I used the Australian spelling of ‘colour’ for the style and couldn’t get it to work.

I was wondering if that’s just an issue in the test (needing an exact match to be correct), or is it a universal thing that US spelling of words is required to make html/CSS work?

Thanks!
Karoline

1 Like

there is only one accepted way to write a css property or the name of an html element, it is usually the american spelling, yes.

2 Likes

Okay, cool. Thanks so much for letting me know.

Hi @Karoline

Welcome to FCC. One trick that has helped me so far is to always think of CSS, HTML and JS as computer languages independent of natural languages like English, French, Spanish e.t.c. They have their own rules about grammar and spelling.

2 Likes

Thanks for the welcome, @nibble ! And this great tip. I remember how beneficial it was to drop the constant comparisons to English when I was learning Portuguese, so this makes total sense.

Can I bother you with another beginner question since we’re here? Do I need to pay attention to the indenting that I’m noticing?

For example:

h2 { color: blue; }

[Sorry, the code I pasted in isn’t showing the way it does in the test screen but it’s the lesson on using the CSS selector to style an element.]

The h2 automatically went inward but I had to backspace to get that closed style tag to line up with the opening one. Do I need to do understand and replicate the indenting or will it work itself out? (Wishful thinking there? :grinning: )

The standard formatting would be

h2 {
  color: blue;
}

So that’s what the autocomplete would give you with the braces

But in a project in your own IDE you would have an extension that deal with keeping the formatting consistent, so it’s not that important in most cases, as long as it is readable and can be understood easily

1 Like

If I were you, I wouldn’t worry about indentation. As long as the code is correct, you can format it by pressing the key combination CTRL + SHIFT + I . I am using Ubuntu. I am not certain but it could be different for your OS.

Like @ilenia mentioned, we format CSS code to make it more readable for human beings but the machine can still understand it, even without the formatting provided it is correct.

1 Like

Awesome. Thanks again, and to you @ilenia . I’ll let it be ugly first and aim for pretty later.

Just as a very minor aside, if you ever use any of the named HTML “gray” colours in your CSS, as in .some-element { color: gray; }, you can spell them with an e, as in “grey”. Afaics that’s the only concession to non-US spelling. Why it’s allowed I don’t know, the ability to do that seems to have been added to HTML/CSS at some point

1 Like

Interesting! Every concession is a relief, so I’ll take it. I wonder if it’s the impossibility of remembering which spelling of grey is correct. Maybe it’s not just me after all.

1 Like

Haha, I’ve been working as a dev for quite a few years now and I still regularly mess up on spelling – UK based, so at work we tend to automatically name things (functions, classes, variables, object properties, etc) using UK spelling. And then when writing the code I’ll mix up spelling of stuff we’ve written with built-in stuff. And sometimes one of us will use US spelling for something we’ve written, which confuses things yet further. When it’s something like “colour” it’s often hard to spot as well – it’s a single letter, so even if it gets highlighted as an error, often spend several moments staring at it because it doesn’t immediately jump out as a misspelling. :upside_down_face::upside_down_face:

3 Likes

One, easy way to prevent this from happening, is to set clear, company-wide code standards. It helps a lot. Especially in the long run.

We do, we use UK spelling; this doesn’t avoid the problem. Mandating US spelling would have exactly the same result. It’s just mildly annoying when I or someone else makes an error, nothing more.

Errors are part of our lives;we are all humans after all…