Writing & StyleStyle guide

Avoiding Horizontal Scrollbars in Code Blocks

Avoiding Horizontal Scrollbars in Code Blocks records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.

Quick answer

Keep code examples readable without unnecessary horizontal scrolling by choosing concise, appropriately sized snippets and formatting.

Key details

Core Issuehorizontal scrolling in code blocks
RegisterMicrosoft Learn technical documentation

Important caveats

Scope Boundary

This is Microsoft Learn code-example guidance; unavoidable long syntax may require context-specific treatment rather than arbitrary code changes.

Further guidance

Content

Keep code examples readable without unnecessary horizontal scrolling by choosing concise, appropriately sized snippets and formatting.

Purpose

Keep technical documentation readable, reusable, and unambiguous for readers while following current Microsoft Learn contributor conventions.

Sources and evidence

Sources are shown with the role they play in this guide. Historical or style-sensitive claims are kept within the evidence boundary described above.

  1. How to include code in docs — Microsoft Learn Contributor Guide (opens in a new tab)Microsoft · Current Microsoft Learn contributor guidance on including code in documentation, including link/code styling, code-block quality checks, screenshots, validation, highlighting, scrollability, bad-code labeling, and in-repository snippet references.

Related guides

Writing & Style

Highlighting Key Lines in Code Blocks

Highlighting Key Lines in Code Blocks records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.

Writing & Style

Using Approved Language Tags in Fenced Code Blocks

Using Approved Language Tags in Fenced Code Blocks records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.

Writing & Style

Automating Code Validation in Documentation

Automating Code Validation in Documentation records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.

Writing & Style

Avoiding HTML Tables in Microsoft Learn Markdown

Avoiding HTML Tables in Microsoft Learn Markdown records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal writing rule.

Writing & Style

Avoiding IDE Screenshots for Code Examples

Avoiding IDE Screenshots for Code Examples records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.

Writing & Style

Avoiding Inline HTML in Microsoft Learn

Avoiding Inline HTML in Microsoft Learn records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal writing rule.

Writing & Style

Avoiding Inline Styling in Headings

Avoiding Inline Styling in Headings records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.

Writing & Style

Avoiding Inline Styling in Link Text

Avoiding Inline Styling in Link Text records a distinct Microsoft Learn authoring convention and keeps it scoped to that documentation environment rather than presenting it as a universal grammar rule.

Explore the topic