You are here: PSPad forum > English discussion forum > Tab set at two spaces but HTML outputs as four?

Tab set at two spaces but HTML outputs as four?

#1 Tab set at two spaces but HTML outputs as four?

Posted by: Merry Prankster | Date: 2013-09-14 16:41 | IP: IP Logged

Hi,
I have tab set at two spaces but when I check the source code for HTML, all of the tabs are output as four spaces. Is there any way of changing this?

Cheers.

Options: Reply | Quote | Up ^


#2 Re: Tab set at two spaces but HTML outputs as four?

Posted by: carbonize | Date: 2013-09-14 17:34 | IP: IP Logged

Just to clarify you mean you have PSPad set up as the viewer for the source code in your web browser?

--
Carbonize

Options: Reply | Quote | Up ^


#3 Re: Tab set at two spaces but HTML outputs as four?

Posted by: Merry Prankster | Date: 2013-09-14 19:28 | IP: IP Logged

Hey, cheers for the reply.

What I mean is that I have written a php page in PSPad and then opened it in Firefox. When I right-click and look at the source code, any tags that I have indented using the tab (which is set to two spaces in PSPad) are indented four spaces in the source code, but only two spaces when viewed in PSPad.

Options: Reply | Quote | Up ^


#4 Re: Tab set at two spaces but HTML outputs as four?

Posted by: myf | Date: 2013-09-15 15:13 | IP: IP Logged

As I understand your issue, it has nothing to do with PSPad but with Firefox; it is not that there are spaces in the source, but how the tab character appears while viewing in Firefox. (It is the purpose of using tabs: anyone can define his/hers own preferred tab size.)

If you want to make Firefox display tabs in source as "2 spaces" instead of 4, follow these steps:

- new tab, URL:about:support
- find "Profile Folder" and click "Show folder" button next to it
- there find (or create) folder "chrome"
- there (create and) edit file "userContent.css"
- add content#viewsource { -moz-tab-size: 2 !important; }
- save and restart Firefox.

I think you could safely use even* { -moz-tab-size: 2 !important; }what will affect everything, but besides viewing source and writing in textarea (where tab size is even 8 by default) I cannot recall other appearance that would deserve alterations.

Options: Reply | Quote | Up ^


#5 Re: Tab set at two spaces but HTML outputs as four?

Posted by: carbonize | Date: 2013-09-15 18:59 | IP: IP Logged

As myf has just said a tab is a tab and each viewer treats it as a different number of spaces. This is why I always use spaces in my code and not tabs.

--
Carbonize

Options: Reply | Quote | Up ^


#6 Re: Tab set at two spaces but HTML outputs as four?

Posted by: gwinkless | Date: 2013-10-08 12:31 | IP: IP Logged

carbonize:
As myf has just said a tab is a tab and each viewer treats it as a different number of spaces. This is why I always use spaces in my code and not tabs.

Which is of course fundamentally wrong; you might have a preference for 3 spaces, I might have a preference for two. If you use spaces, whenever I look at your code it looks wrong to me. If you use tabs, your code looks fine for both.

Unless you're doing horrible things like lining up indents, in which case you should tab to the start of the previous line, then space after that.

So

<tab><tab>int myfunction (
<tab><tab><spaces to here>int param1,
<tab><tab><spaces to here>int param2,
<tab><tab><spaces to here>int param3,
<tab><tab><spaces to here>)

</rant>

Options: Reply | Quote | Up ^


#7 Re: Tab set at two spaces but HTML outputs as four?

Posted by: carbonize | Date: 2013-10-08 20:37 | IP: IP Logged

There is nothing fundamentally wrong with using spaces it's just a matter of choice. I personally hate tabs because of how they come out different across various readers where as I always know how spaces are going to appear.

You like tabs, I like spaces. Neither of us is right, neither of us is wrong.

--
Carbonize

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR