Support » Fixing WordPress » Spacing in HTML

  • You’re a good ol’ Notepad HTML coder. You write your website HTML with Notepad.

    When you write HTML, some people prefer to add tabs when they open tags like so:

    --tab--<div class="header">
    --tab----tab--My site dot com.
    --tab----tab----tab--<div class="headimg"></div>
    --tab--<div class="body">
    --tab----tab--My content.

    Putting tabs adds structure and makes it easier for the coders.

    The problem.

    With WordPress, it does not respect your spacing.

    Say you’re in a navigation. div. You’re writing with 5 tabs inserted in front of you. If you call WordPress and ask it to insert a series of links, it will insert this code at the beginning of a line, with no tabs in front of them, therefore, ruining your whole HTML structure.

    Is there a plugin which respects tabs inserted in HTML?

Viewing 7 replies - 1 through 7 (of 7 total)
  • It’s not ruining your HTML structure. The code doesn’t care if there’s tabs in there or not, only you do. Since wordpress is dynamically generating stuff, it puts it in as a straight text string…. but you’re never going to edit the dynamically generated code (although you may have to debug it)..

    Anyway, someone COULD (in theory at least) go into everywhere its generating the code and put the tabs in, but it’s really not worth it.

    I personally hate all the tabbing, so I deleted all of them within my template. Any that are inserted are put there by the WordPress core code, and it works for me.

    Also, this obsession with tabbed order is nice but kinda odd, too. Some text editors totally scramble all that tabbing when viewing source code.

    The biggest concern with spacing is website optimization. If you are into lean and mean css and html, struggling to clean it up so not an extra character shows up because the content on your page is so vast, you need every millimeter of bandwidth just to load your page within 10 seconds or less….then your problem isn’t with extra spacing in code but too much information on a page. Cut that down or break it up into smaller pages.

    Lean and mean code is wonderful, and I’m a firm believer in it, mostly because the process of optimizing a site teaches you more about how all of this stuff works.

    Agreed, Lorelle – but anyone who writes code others may be using NEEDS to organize that code so that it’s easy to see the underlying structure. And they need to comment it liberally!

    Again though, if it’s simply code one is writing for one’s own use, inline tags is fine….

    From the user perspective the code I find easiest to read runs straight down the left. Maybe indented one click off the left hand but nothing more. No extra indenting at all. The eye only needs to go one way. I am starting to edit like that too.

    For code that doesn’t “do” tables, that’s true. Unfortunately, I still have some sites which I’m not allowed to “de-table” and it’s almost a necessity to indent the table structure tagsets, just so you can see what’s where.

    Otherwise, I’m beginning to (for myself anyway) do as you’ve said, Root. Sometimes a lot of indent is as bad as all run together….

    I guess you could always add ‘\t’ to the “before” paramaters in various functions which would/might indent stuff for you by a single tab. It all depend on where “before” is added, though.


    If my memory serves my correct, I believe Textpattern respects tabbing…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Spacing in HTML’ is closed to new replies.