For the most part, it just depends on the programmer's style.
Most programmers indent things with the "tab" key:
the code you see on a live website is often different than what the programmers developed it with.
Many websites condense their code, some even go as far as condensing it into 1 line (you see that with CSS a lot).
Take a look at these website's CSS: http://www.youtube.com/ https://twitter.com/
(1 line condensed CSS)
If you see code all condensed, chances are they didn't develop it like that. Any experienced programmer would be smart enough to make the code as simple as possible to read while developing (nicely indented), however when it comes to making the code live (putting it on a live website), many large websites with high traffic, condense the code as it speeds up page load time and server load:
HTML compressor CSS compressor
As a beginning developer, you should definitely make your code easy to read, indent things so that you
can easily read it and since your websites probably won't get high traffic, I would highly
recommend you just publish your code as you wrote it (no need to compress and save half a second).
It's easy to get consumed with how your code looks on view source, but let me reassure you that that will improve naturally with your time in programming.