WordPress.org

Ready to get started?Download WordPress

Forums

Spacing in HTML (8 posts)

  1. ralph
    Member
    Posted 9 years ago #

    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:

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

    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?

  2. tbaxter
    Member
    Posted 9 years ago #

    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.

  3. Lorelle
    Member
    Posted 9 years ago #

    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.

  4. vkaryl
    Member
    Posted 9 years ago #

    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....

  5. Root
    Member
    Posted 9 years ago #

    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.

  6. vkaryl
    Member
    Posted 9 years ago #

    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....

  7. rwatkins
    Member
    Posted 9 years ago #

    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.

    Rob

  8. ralph
    Member
    Posted 9 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.