Page 1 of 1
Setting tab width for pre-formatted code
Posted: Wed Mar 02, 2016 11:00 am
by cherid
Anyone know where you can set the tab width? I'm inserting code into a <pre> tag, and it appears that the default for tabs is 8 characters. I'd like to make that smaller. Can I? I've hunted and hunted and can't seem to find anything about this.
Thanks!
Re: Setting tab width for pre-formatted code
Posted: Wed Mar 02, 2016 3:34 pm
by LTinker68
You can adjust the margin values for the <pre> tag in the stylesheet editor, same as any other tag. BTW, that 8 character length might be browser-dependent, so if your users might use any browser, then you might want to test your output in multiple browsers to make sure you didn't move it too far. For example, browsers indent bullets different amounts, so a margin-left value of 0 in one browser may put it flush left to the margin, but in another browser it may appear as if it were a negative margin or still indented a few characters. It's extremely annoying how they aren't consistent. So if you adjust the margin-left of the <pre> tag, make sure you test it in multiple browsers.
Re: Setting tab width for pre-formatted code
Posted: Thu Sep 22, 2016 6:18 am
by moshe
If I understand correctly, the question wasn't about margins for the HTML pre tag, rather how to set tabs that you are using within the pre tag to display things like code indentation. You want the tabs to be less than 8 characters wide so you can properly display stuff like code that has multiple levels of indentation. When the tab takes up 8 characters, the indentation takes up too much space.
Setting a left margin for the pre tag will move the entire code block, but won't affect the tabs within the code block.
The proper way to do this is using the CSS tab-size property, but it appears that Flare doesn't properly recognize this CSS property.
Similarly, there is a CSS white-space property, which is supposed to be able to control the wrapping of long lines of text. This also can be useful in properly displaying code blocks. However, it appears that Flare doesn't properly recognize this CSS property either.
I hope that I'm wrong about Flare not recognizing these CSS properties, but in a current Flare project, I can't get them to work.
Hope this helps,
Moshe
Re: Setting tab width for pre-formatted code
Posted: Thu Sep 22, 2016 11:58 pm
by NorthEast
The Flare editor doesn't display a lot of CSS properties, but if you check the output they should work.
You could use
tab-size, but it appears it isn't supported in all browsers.
http://www.w3schools.com/cssref/css3_pr_tab-size.asp