Image Syntax
Images are important visual elements in documentation. Markdown provides a concise syntax for inserting and managing images.
Basic Image Syntax
Inline Images
Use the format 
:
markdown

Images with Title
Add an optional title:
markdown

When you hover over the image, the title text will be displayed.
Reference-style Images
Basic Reference Style
markdown
![alt text][image-ref]
[image-ref]: https://www.markdownlang.com/image.jpg "Optional Title"
Shortcut Reference Style
When the reference label is the same as the alt text:
markdown
![Markdown Logo][]
[Markdown Logo]: https://www.markdownlang.com/markdown-logo.png
Image Path Types
Absolute URL
markdown

Relative Path
markdown



Root-relative Path
markdown

Advanced Image Features
Image Links
Wrap an image in a link:
markdown
[](https://www.markdownlang.com)
Rendered Output: Clicking the image will jump to the specified link.
Controlling Images with HTML
Specify Size
markdown
<img src="image.jpg" alt="Description" width="300" height="200">
Image Alignment
markdown
<!-- Center align -->
<div align="center">
<img src="image.jpg" alt="Centered Image" width="400">
</div>
<!-- Right align -->
<div align="right">
<img src="image.jpg" alt="Right Aligned Image" width="300">
</div>
Responsive Images
markdown
<img src="image.jpg" alt="Responsive Image" style="max-width: 100%; height: auto;">
Image Combination Display
Side-by-side Display
markdown
<img src="img1.jpg" width="45%"> <img src="img2.jpg" width="45%">
Image Grid
markdown
<table>
<tr>
<td><img src="img1.jpg" width="200"></td>
<td><img src="img2.jpg" width="200"></td>
</tr>
<tr>
<td><img src="img3.jpg" width="200"></td>
<td><img src="img4.jpg" width="200"></td>
</tr>
</table>
Mixed Image and Text
markdown
<img src="avatar.jpg" align="left" width="100" style="margin-right: 10px;">
This is a paragraph of text with the image floating on the left. The text will wrap around the image, creating a mixed layout. This can be used for personal profiles or product introductions.
<div style="clear: both;"></div>
Best Practices for Alt Text
Descriptive Text
markdown
✅ Recommended: Describe the image content

❌ Not recommended: Meaningless text


Functional Images
markdown
✅ Recommended: Explain the image's function


❌ Not recommended: Repeating surrounding text
Click  to search
Decorative Images
markdown
✅ Recommended: Use empty alt text for decorative images

❌ Not recommended: Unnecessary description

Common Image Formats
Web-friendly Formats
Format | Usage | Features |
---|---|---|
JPEG | Photos, complex images | Small file, lossy compression |
PNG | Icons, transparent backgrounds | Lossless compression, supports transparency |
WebP | Modern web images | Smaller size, better quality |
SVG | Vector graphics, icons | Scalable, small file |
GIF | Simple animations | Supports animation, limited colors |
Format Selection Advice
markdown
✅ Recommended usage:
 ← JPEG for photos
 ← PNG for icons
 ← SVG for vector graphics
 ← GIF for simple animations
❌ Not recommended:
 ← JPEG not suitable for icons
 ← PNG files can be large
Image Optimization Tips
File Size Optimization
Choose the right resolution
markdown<!-- Recommended for web display --> <img src="image.jpg" width="800" alt="Description"> ← 2x image for high-DPI screens
Use appropriate compression
markdown<!-- JPEG quality: 70-80% recommended --> 
Lazy Loading
markdown<img src="image.jpg" alt="Description" loading="lazy">
Using CDN and Image Hosting
markdown
<!-- Use CDN for acceleration -->

<!-- Image hosting service -->

Common Errors and Solutions
1. Path Error
markdown
❌ Error:
 ← Path does not exist
✅ Correct:
 ← Check file path
 ← Use correct relative path
2. Missing Alt Text
markdown
❌ Error:
 ← Important image missing description
✅ Correct:

3. Size Control Issue
markdown
❌ Issue: Image too large
 ← May break layout
✅ Solution:
<img src="huge-image.jpg" alt="Large Image" style="max-width: 100%;">
4. Image Link Issue
markdown
❌ Error:
[(https://www.markdownlang.com) ← Syntax error
✅ Correct:
[](https://www.markdownlang.com)
Practical Scenarios
1. Technical Documentation
markdown
## Installation Steps
1. Download the installer

2. Run the installer

3. Complete the installation

2. Product Showcase
markdown
## Product Features
### Modern UI Design
<div align="center">
<img src="ui-screenshot.png" alt="Product UI Screenshot" width="600">
<p><em>Clean and intuitive user interface</em></p>
</div>
### Multi-platform Support
<table>
<tr>
<td align="center">
<img src="windows-logo.png" width="60"><br>
<strong>Windows</strong>
</td>
<td align="center">
<img src="mac-logo.png" width="60"><br>
<strong>macOS</strong>
</td>
<td align="center">
<img src="linux-logo.png" width="60"><br>
<strong>Linux</strong>
</td>
</tr>
</table>
3. Personal Profile
markdown
## About Me
<img src="avatar.jpg" align="right" width="150" style="margin-left: 20px; border-radius: 50%;">
Hello! I am a full-stack developer focusing on modern web technologies. I have over 5 years of development experience and am familiar with various programming languages and frameworks.
### Skill Stack



<div style="clear: both;"></div>
4. Tutorial Instructions
markdown
## Code Editor Configuration
Follow these steps to configure your development environment:
1. **Open Settings**

2. **Search for Configuration Items**

3. **Modify Configuration Value**

> 💡 **Tip**: Restart the editor after configuration to ensure the settings take effect.
Accessibility
Write Meaningful Alt Text
markdown
✅ Recommended: Detailed description

❌ Not recommended: Simple repetition

Use Structured Descriptions
markdown

HTML Output
Markdown images are converted to HTML:
markdown

Converted to:
html
<img src="image.jpg" alt="Alt Text" title="Image Title">
Reference-style images:
markdown
![Alt Text][ref]
[ref]: image.jpg "Title"
Converted to:
html
<img src="image.jpg" alt="Alt Text" title="Title">
Related Syntax
- Link Syntax - Creating links
- HTML Syntax - Embedding HTML
- Fenced Code Blocks - Code highlighting
Practice
Try creating the following:
- A product showcase page with multiple product images
- A technical tutorial with step-by-step screenshots and explanations
- A team introduction page with member avatars and information
- A comparison chart showing data trends
Recommended Tools
Image Editing Tools
- Online Tools: Canva, Figma, Photopea
- Desktop Software: GIMP, Paint.NET, Adobe Photoshop
- Screenshot Tools: Snipaste, Lightshot, built-in screenshot tools
Image Optimization Tools
- Compression Tools: TinyPNG, ImageOptim, Squoosh
- Format Conversion: CloudConvert, Online-Convert
- Batch Processing: ImageMagick, XnConvert
Image Hosting Services
- Free Services: GitHub, Gitee, sm.ms
- Paid Services: Qiniu Cloud, Alibaba Cloud OSS, Tencent Cloud COS
- CDN Acceleration: jsDelivr, Cloudflare, AWS CloudFront