Indention in HTML -images

Hi - I noticed when I indented my URL code on its second line to put the image of the bear in the exercise, the image did not display. I assume because I added extra spaces that broke the URL?

Just wondering what I should be doing going forward when you have indentation and a single line code that spans more than one line when typed out, do you indent it all and risk breaking it? Or do you let the next line flow naturally to the far left of the page? Or is the CodeCademy IDE/browser unique and when using a standalone text editor I wouldn’t have this problem?

FYI, when I refreshed my browser other multi-line paragraph code removed the indentations that I added earlier as well with no ill effects. Thank you.

Hi,

Indention shouldn’t effect the output,

Please paste in your code so that I can have a look and help you

Typing/pasting this works without any indentation on the second line with untouched text wrapping:

img src=“https://s3.amazonaws.com/codecademy-content/courses/web-101/web101-image_brownbear.jpg” /

But indenting on second line does this and breaks the URL:

img src=“https://s3.amazonaws.com/codecademy-content /courses/web-101/web101-image_brownbear.jpg” /

So is proper technique to not indent here or is there another way?

(Note no angle brackets included at ends as forum thinks I’m uploading images.)

Edit…browser just hid the space after I posted it, is there no preview post function on this forum?

The break looks like this between content and courses: /codecademy-content /courses/web-101/

Edit 3…never mind it hid the spaces again. I give up.

1 Like

Here’s how to format code in the forum:

When it comes to indenting you indent the entire tag and not in the middle of the code, here you are breaking the URL

so indenting would be like this:

    <div class='location_box' id=location_one>
       <h3>Downtown</h3>
       <span>Address line 1</span>
       <span>Adress line 2</span>
       <img src=“https://s3.amazonaws.com/codecademy-content/courses/web-101/web101-image_brownbear.jpg” />
    </div>
1 Like

Hi, thank you for responding again.

Hmm, when I copy and paste or type the full tag it automatically wraps once it hits the end of the text window, hence the source of confusion. That’s when I tried to manually indent it and broke it. I guess I should just leave it untouched in the future, regardless of what it looks like.

FYI, your link seems to be redirecting to codecademy’s catalogue though when I open it.

1 Like

Pasted in the wrong url, How do I format code in my posts?

1 Like

Great, link now working, I will check it out. Thanks again.

2 Likes