← Back to blog/Guides

Markdown Image Size: Resize Screenshots Without Breaking the Layout

Standard Markdown does not define image dimensions. Choose the right HTML, CSS or MDX approach, preserve proportions and keep support screenshots readable on smaller screens.

F
Faizan Khan
• 8 min read

Standard Markdown has no universal image-size parameter. This displays an image, but does not specify its width:

Markdown
1![The notification settings panel](/images/notification-settings.png)

To control the size, use your documentation platform's image controls, supported HTML, or an MDX component. The right choice depends on what renders the page. A snippet that works in an MDX site can be rejected, stripped or ignored by a different Markdown service.

For a help-center screenshot, the objective is usually simple: show the relevant controls at a readable size, preserve the original proportions and avoid overflowing a phone screen. This guide works through those decisions without treating every renderer as interchangeable.

Choose the sizing method your renderer supports

Where the article is renderedStart withCheck before publishing
A Markdown service with a built-in image editorIts display-width or image settingsWhether export retains the chosen size
Markdown with permitted raw HTMLAn HTML image with dimensions, plus supported responsive CSSWhether HTML or style attributes are sanitized
An MDX documentation siteA JSX image or the site's image componentComponent props, source paths and React style syntax
A Markdown renderer you do not controlStandard image syntax and an appropriately prepared source fileWhether it supports an extension for dimensions

The CommonMark image specification defines the destination, alternative text and optional title. Width and height are not part of that standard image syntax. Formats such as ![alt](image.png =640x360) are renderer-specific extensions, not portable Markdown.

Do not hide a crucial instruction in a screenshot simply because you cannot choose a display width. Write the action in the article text as well.

Resize with HTML when raw HTML is allowed

For a source image that is 1280 pixels wide and 720 pixels high, these proportional dimensions request a smaller display:

HTML
1<img
2 src="/images/notification-settings.png"
3 alt="Notification settings with email alerts enabled"
4 width="640"
5 height="360"
6/>

These are illustrative paths; substitute an image that exists in your site. The dimensions retain the source's 16:9 ratio. They do not create a smaller image file or remove sensitive information from it.

HTML support is a prerequisite, not a guarantee. A hosted Markdown service may filter attributes, apply its own image component or disallow raw HTML. For example, the GitHub Flavored Markdown specification notes that GitHub performs additional sanitization after converting Markdown to HTML. Test the actual destination rather than assuming that a local preview has the same policy.

Keep the image inside a narrow article column

If you control the site's stylesheet, apply a class:

HTML
1<img
2 class="help-screenshot"
3 src="/images/notification-settings.png"
4 alt="Notification settings with email alerts enabled"
5 width="640"
6 height="360"
7/>
CSS
1.help-screenshot {
2 display: block;
3 max-width: 100%;
4 height: auto;
5}

Here, the chosen display width can shrink to fit the containing column, while the height follows the image's proportions. MDN's max-width reference explains how a maximum constrains an element's used width. A percentage is relative to the containing block, not necessarily the whole browser window.

If the platform permits inline CSS but not a custom stylesheet, it may accept this HTML version:

HTML
1<img
2 src="/images/notification-settings.png"
3 alt="Notification settings with email alerts enabled"
4 width="640"
5 height="360"
6 style="display: block; max-width: 100%; height: auto;"
7/>

Use this only where inline styles are supported. A sanitizer can remove the style attribute, and a site's stylesheet may impose other sizing rules.

Use JSX syntax for MDX image styles

MDX supports JSX. Its style prop uses a JavaScript object, not an HTML style string. A plain image can look like this:

MDX
1<img
2 src="/images/notification-settings.png"
3 alt="Notification settings with email alerts enabled"
4 width={640}
5 height={360}
6 style={{ display: 'block', maxWidth: '100%', height: 'auto' }}
7/>

Notice maxWidth, rather than max-width, inside the object. That is React's style convention. The React style documentation covers camel-cased property names and object values.

Your site may provide an Image, Screenshot or other component instead of a native img element. Check its documented props before substituting it. A framework's image component can require different source handling or dimensions; its API is not defined by Markdown.

When a page fails to compile, inspect the syntax before changing the asset. Unclosed tags, malformed braces and HTML-style strings used as React style props are different problems from a file being too large. Our MDX preview and production parity walkthrough demonstrates a separate failure mode: preprocessing can change source that originally compiled correctly.

Width and height should describe the same proportions

Suppose the original screenshot is 1200 by 800 pixels. A width of 600 and a height of 400 retain its 3:2 ratio. A width of 600 and a height of 200 do not.

Choose one of these approaches deliberately:

  • Provide proportional dimensions and allow responsive CSS to shrink the image.
  • Set a display width and allow height to follow automatically, using the controls your platform supports.
  • Crop the source to a new composition, then use dimensions matching that new file.

Cropping and stretching are not equivalent. Cropping can remove an irrelevant sidebar; stretching changes the shape of every label and control. If you crop, check that the screenshot still provides enough context to identify the right screen.

Accurate dimensions also help browsers reserve space before an image loads. The web.dev layout-shift guide explains why missing image dimensions can cause content to move. Do not remove all dimensions as a universal performance fix; coordinate them with the actual aspect ratio and responsive rules.

Display size is not compression

A large screenshot displayed at 640 pixels can still transfer the original large file. Reducing its CSS width does not resample or compress it.

Treat these as separate decisions:

DecisionWhat changesWhat it does not solve
Display widthHow much layout space the image usesOriginal file weight
Resize the source fileThe image's pixel dimensionsWhether the page fits mobile layouts
Compress or change formatThe encoded file and possibly visual qualityIncorrect screenshot content
CropWhich part of the screenshot remainsMissing written instructions

Start by removing unnecessary screen area. Then prepare an appropriately sized source and inspect labels at the intended display size. Over-compression can make small UI text difficult to read; serving a huge original can waste transfer without improving the task.

A higher-density source can help on a high-density display, but it is not a reason to upload every screenshot at the maximum available size. Choose based on the actual content and reading surface. MDN's image reference documents responsive source selection with srcset and sizes where your platform supports it.

Resize images in the DocsAlot editor

For supported image blocks, the DocsAlot editor provides a Display width (px) field, Apply size and Auto. Enter a whole-number width from 1 to 4096, or choose Auto to remove the explicit display-width choice. This controls presentation; it does not upload or resample the original asset.

After applying a size, preview the article in its actual layout. A width that works in a wide article can be too much inside a table or narrow callout. If you publish through Markdown or MDX files instead, verify how the source attributes are preserved by that path rather than assuming that every external renderer uses the editor's rules.

For a migration, include screenshot paths and important image dimensions in your acceptance review. Our documentation migration checklist covers the broader content, URL and access checks.

A practical screenshot review before publishing

Use one representative how-to article, not just an isolated image file:

  1. Open the article at desktop width and then in a narrow viewport. Check for horizontal overflow and unreadably small labels.
  2. Follow the task using the written steps. The image should clarify the action, not carry the only copy of a required setting.
  3. Confirm the screenshot matches the current product. A sharply rendered image of an old menu is still misleading.
  4. Check alternative text. Describe the useful information or function, rather than repeating the filename. The W3C alternative-text decision tree helps distinguish informative and decorative images.
  5. Verify that no names, credentials, private tickets or account details remain visible. Display-width settings do not redact the source file.
  6. Publish to a review surface and inspect the final rendered page. Compilation alone cannot establish readability, responsive behavior or sanitizer behavior.

For repeated support procedures, use a consistent knowledge-base article template. For simple text comparisons, a Markdown table is often more searchable and easier to update than a screenshot of a spreadsheet.

Troubleshooting common image-size problems

SymptomCheck firstLikely next action
The size suffix appears in the URL or does nothingWhether the renderer supports that Markdown extensionUse its documented controls or supported HTML
The image becomes distortedWidth, height and source aspect ratioRestore proportional dimensions and automatic height
The image overflows on a phoneContainer width and applied CSSAdd supported responsive constraints or fix the component
Inline styles disappearSanitization or content policyUse an approved class or platform image controls
The screenshot is blurrySource detail at the final display sizeRecapture or prepare a better source rather than only enlarging it
The MDX page fails to compileJSX tags, braces and style syntaxCorrect the source; resizing the binary image will not fix syntax
A small displayed image still loads slowlyOriginal file weight and delivery pathOptimize the source separately from display dimensions

The reliable rule is to separate syntax, layout and the source asset. Confirm what the renderer accepts, preserve the image's proportions and prepare a file that makes the support task easy to complete.

Continue This Guide