| | |
Tab width within Code tags
![]() |
This contains a tab This contains 4 spaces But this contains 8 spaces
My suggestion is to change the option in your text editor to convert tabs to spaces because some people might use 8 spaces while others 4 or some other number. I've even seen just 2 spaces.
Last edited by Ancient Dragon; Mar 28th, 2008 at 11:31 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
CSS 2 doesn't appear to have a tab-width property. The following are the properties that can be applied to text elements: http://www.w3schools.com/css/css_reference.asp#text
Dani the Computer Science Gal 
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds

Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
I know that if I use the option to replace tabs with 4 spaces (which I already do in Visual Studio), this problem would be over for my code. But we do not have control of the other user's editors. When they post codes with the tab character used for indenting, even code with a level 4 nesting can wrap unnecessarily. Sometimes I copy and paste the code to my own editor and replace tabs with 4 spaces to make the code readable, and was wondering if there was a quick fix. But if as Dani says that nothing can be done about it, well I guess we should grin and bear.
バルサミコ酢やっぱいらへんで
I believe it is a platform-specific setting ... i.e. Your OS/browser determines how many spaces per tab.
Dani the Computer Science Gal 
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds

Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
Gah, I hate when this happens! I was googling to see if there is a solution or workaround to this problem, only to find something that was specifically what I was looking for. I click on it and it ended up being this very thread.
Dani the Computer Science Gal 
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds

Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
I'm not going to try to pretend that I'm any sort of web programming expert, but couldn't you modify your parser to change tab characters into spaces? That way you could specify a manual tab width within the code tags, like Narue suggested.
"Technological progress is like an axe in the hands of a pathological criminal."
All my posts may be freely redistributed under the terms of the MIT license.
All my posts may be freely redistributed under the terms of the MIT license.
That's a very brute force method that would undermine the purpose of tabs, screwing up more things than it fixes. For example, if tabs were to be converted into two spaces, the following:
Would be translated, without the poster's intent, into:
php Syntax (Toggle Plain Text)
echo "Hello World!"; // This is line one echo "DaniWeb"; // This is line two echo "Blah blah blah blah!"; // This is line three
php Syntax (Toggle Plain Text)
echo "Hello World!"; // This is line one echo "DaniWeb"; // This is line two echo "Blah blah blah blah!"; // This is line three
Dani the Computer Science Gal 
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds

Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
C'mon Dani, you can't fool me; I know you can do it.
How hard would it be to make your parser calculate the number of spaces to insert to make it line up to the next tab stop?
How hard would it be to make your parser calculate the number of spaces to insert to make it line up to the next tab stop? "Technological progress is like an axe in the hands of a pathological criminal."
All my posts may be freely redistributed under the terms of the MIT license.
All my posts may be freely redistributed under the terms of the MIT license.
![]() |
Similar Threads
- Open In New Window Php (PHP)
- Get rid of the editing time limit!!!!! (DaniWeb Community Feedback)
- Go to a certain page when button is pressed and do it securely (ASP.NET)
Other Threads in the DaniWeb Community Feedback Forum
- Previous Thread: JavaScript Fix
- Next Thread: Posting C code is a frustration experience
Views: 3119 | Replies: 34
| Thread Tools | Search this Thread |
Tag cloud for DaniWeb Community Feedback
+ abuse beginners bookmark bored box bug bugs calamity code codebox codesnippets codetags code_snippet comments complaining cpuintensive daniweb design editcodesnippet end-of-the-world favouriteforums feedback ff3 flamewar glitch ie6 itsatag! kids layout login lulz negative newfeature poll post preview privatemessaging problem profanitytest profile quality quick rash-bot rashakil-fol reply reputation reputation-power sandwich score search snippet so-what socialgroups solvedthreads sub-forum suggestion tagcloud tagging tags theactualrulerofthetag-cloud:3 therulerofthetag-cloud:[ thread threadtagging today's-posts unansweredposts upgrade user voting whining who-cares yada-yada






