Completely new to coding (weird question)


#1

I’ve only just started looking into this but I had a random question I don’t think I’ve seen. So, say I make a line of code

I'm lost and this is a bad example

<-----> <-----how far should that space be? I don't understand that spacing. Should it do it on its own or is that space always manual ...would anyone be able to elaborate on this please and thank you.

#2

Can you describe what it is you are asking by includeing some code?

In HTML,

<!-- this is a comment -->.


#3

I’m brand new to coding, and to this website. I’m sorry idk how to do anything in HTML. However, my question is this…when you write code and make the first line of code…the second line has to be indented, correct ? Every line of code won’t be pressed against the left side. So, how do I know how far that indentation should be? or does it automatically do it on its own…is this a strange question, haha.


#4

No. In HTML there is no requirement for this.

<body><div><h1>heading</h1></div></body>

is valid HTML. Read up on white space as it pertains to HTML and you will learn that any we add is by convention, not by requirement.

<body>
  <div>
    <h1>heading</h1>
  </div>
</body>

#5

I see it doesn’t matter now. I had wondered this because it seems every code project I see, that is HTML, there’s always indentation and all the variables are not all aligned to the left side. But I see now that it is only conditioning. Just to confirm: if I don’t indent and just write each line of code pressed to the left side, the project will still work? I can’t try it as I don’t know how to code and this is barely my first question on here :grin:


#6

If the lesson asks for indentation, then give it. As for whether it is needed for the page to work… No. It doesn’t matter. Just remember to think about the reader (which includes you).


#7

Got it. Thank you so much. Bless your soul, a thousand times and more.