Hi can anyone point me in the right direction to redefine the tabbing element of <pre> tags please.

Dani AI

Generated

A short update to ' original question and 's caution: modern CSS gives a direct way to control how many columns a tab character occupies, and it works for elements that preserve whitespace (like <pre>). This is safer than relying on whatever default the browser uses and easier than hand-replacing every tab in source.

A compact approach is the CSS tab-size property (older Firefox required -moz-tab-size). Example:

pre {
  tab-size: 4;
  -moz-tab-size: 4;
}

Notes and practical tips: tab-size only affects visual rendering — the underlying text still contains tab characters, so copy/paste targets may display them differently. Older browsers may not support it, so if exact, portable spacing is required (for pasted text, email clients, or legacy viewers), convert tabs to spaces at output time or during your build/edit step. For current browser support and details, see the MDN documentation on tab-size: tab-size - MDN.

Recommended Answers

All 2 Replies

It is fixed at 8 spaces. Use of the tab character inside pre tags is discouraged by W3C.

Thanks for the reply, i'll use a different solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.