Jump to content

Indenting with HTML


krow

Recommended Posts

I've been looking at different page sources on the net and I've noticed there are variations in the way the code is usually indented. I would like to know if there are standards to follow as to what's the right indenting technique/style to use or if this is more of a preference? For example, in some pages, especially parts containing images and links inside ul and li tags, sometimes I see the code horribly piled up which makes it really hard to read. How can someone, even experienced web developers actually read that? I've gotten used to always hand writing my html and it seems to me it looks sometimes kind of empty as I always try to separate things so that they are easy to read. But then when I randomly choose websites and view the code, often times the codes I see are much more condensed, some of them left-justified, some of them piled up, etc. I don't have work experience in web development but I do like to develop websites, I'm simply trying to adopt good coding practices. I guess companies take that into consideration when hiring a developer ??? Any comments, suggestions or recommendations on good articles to read will be much appreciated.

Link to comment
Share on other sites

I don't think i've heard any arguments about HTML indentation in all the years I've been developing. It's all a matter of preference.When working with inline or inline-block elements you sometimes have to avoid line breaks and spaces. If you have an unordered list and you set the <li> elements as inline-blocks you'll find that they're slightly spaced apart unless you put all the HTML code together.

.inline li {  display: inline-block;  background-color: blue;} <!-- Rendered without spaces between the list items --><ul class="inline"><li>List item</li><li>List item</li></ul> <!-- List items are separated by a single space each --><ul class="inline">    <li>List item</li>    <li>List item</li></ul>

Link to comment
Share on other sites

I don't think i've heard any arguments about HTML indentation in all the years I've been developing
Good to know! It's just that I don't know what to look at or what to improve in my codes. I've been working on my portfolio lately so that if I get a job offer or something then I'm able to show "something", then they'll know what to expect from me. It's just hard not have friends or someone who can give you tips, suggestions or constructive criticism, even though I know there's plenty of information on the internet about this topic. That's why I decided to turn to forums and clarify the doubts I had. Thanks. Edited by krow
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...