Whitespace wont let me advance?


#1

https://www.codecademy.com/courses/learn-html-elements/lessons/intro-to-html/exercises/white-space-html?action=lesson_resume&course_redirect=learn-html

i have each element on a seperate line but it keeps saying"did you add whitespace to your index.html file?"

> Blockquote<!DOCTYPE html>
<html>
  <head>
    <title>Hello World</title>
  </head>
  <body>
    <h1>Hello World</h1>
    <p> this paragraph is a child of the body element</p>
    <div>
    <p>this paragraph is a child of the div element</p>
    </div>
  </body>
</html>

Blockquote

what am i missing?


#2

Hi @ryanwalmsley,

The lesson gives you an example in the instruction about what is needed to do, basically in order to add white space, the example turn this:

<body><p>Paragraph 1</p><p>Paragraph 2</p></body>

into this, without adding any extra elements, just make each new element in a new line:

<body>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
</body>

So the same would be expected, what do you need to do to transform the code given, in order to follow the instruction of adding whitespace?

<!DOCTYPE html>
<html>
  <body><h1>Whitespace</h1><p>Whitespace and indentation make html documents easier to read.</p></body>
</html>

Remember do not add any extra space or extra new element (you have unnecessary added a space inside <p> and an extra <div></div>)

All you need to do is to turn the code above into what is expected based on the example given above. Should be able to pass the lesson then.

Cheers :slight_smile:


#3

Hi @ryanwalmsley, on a second inspection, the code you gave is actually based on HTML Structure which is the previous step in the lesson, are you asking about WhiteSpace or HTML Structure? Because the link you provided leads to the WhiteSpace lesson, but the code is not supposed to be that way.

You should have something that read along this line:

<p>Whitespace and indentation make html documents easier to read.</p>

If not, I think you have some trouble with the lesson, and you may need to Reset the course. BEWARE: reset the course will erase everything and start you from the beginning, so think carefully about that.


#4

I am having the same problem.

The question is this;

  1. Use whitespace to make the code more readable by putting each element on its own line.

My code looks like this;

<!DOCTYPE html>
<html>
  <head>
    <title>My Coding Journey</title> 
  </head>  
  <body>  
    <p>Shall I compare thee to a summer's day?<br /> Thou art more lovely and more temperate</p> 
    <div>  
      <p>This paragraph is a child of the div element</p>
    </div>  
    <p>This paragraph is a child of the body element</p>
    <h1>whitespace</h1>  
  </body>  
</html>

I have removed the indentation, I have added spaces, I have removed spaces. I keep getting this error.

Did you add whitespace to your index.html file?

If I am understanding correctly, whitespaces can be just plain spaces… If that’s the case, I add spaces, shouldn’t that satisfy the error I am getting? Because according to the lesson, it doesn’t.


#5

Hi @chewey46,

Refer to my previous two posts above, I don’t know what is happening but the lesson is supposed to provide you this code, not the code you posted, see below (this is what is the code you supposed to change):

<!DOCTYPE html>
<html>
  <body><h1>Whitespace</h1><p>Whitespace and indentation make html documents easier to read.</p></body>
</html>

It’s totally different from what you posted, the code you posted is in fact coming from the previous steps, which is the lesson about HTML Structure. I don’t know if this is a glitch from CC or anything else, I have been getting the correct code from the lesson and passing it with no problem.

Maybe you can copy the code I provided above (which is what the lesson is supposed to provide), paste it in, remember to format it with whitespace accordingly, then run it to see if it works?


#6

I think the problem here for me and for others is in the instructions, the differentiable elements of the line “whitespace and indentation make your code easier to read” are not specified. Someone care to just flat out say what the code is supposed to look like?


#7

Yes, in the lesson there is running code from step one to step 10. No where does it say to clear your workspace and do the whitespace code. I think the instructions need to be a little more clear. I did get it figured out.

Thanks for the help!


#8

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