A lightweight JavaScript utility for measuring spacing between elements on webpages during development. Perfect for designers and developers who need precise measurements. Try the demo.
🌍 Available in: English | 繁體中文 | 简体中文
Add SpacingJS directly to your HTML:
<!-- Using UNPKG -->
<script src="//unpkg.com/spacingjs" defer></script>
<!-- Or using jsDelivr -->
<script src="//cdn.jsdelivr.net/npm/spacingjs" defer></script>
npm install spacingjs
Then import and use it in your code:
import Spacing from 'spacingjs';
Spacing.start();
- Hover over any element on your webpage
- Press Alt (Windows) or ⌥ Option (Mac)
- Move your cursor to another element to see the measurements
- Hold Shift to keep measurements visible longer (great for taking screenshots)
- Use the Chrome Extension for permanent access on any website
SpacingJS is available as a Chrome Extension:
- 🚀 Install from Chrome Web Store
- 🛠️ Build it yourself: Run
npm run ext
The dist
folder is intentionally included in the Git repository to ensure CDN reliability. To contribute:
- Make your changes in the
src
directory - Run
npm run build
to rebuild the distribution files - Commit both source changes and rebuilt dist files
- Submit a pull request
- 🐛 Report bugs: GitHub Issues
- 💡 Share ideas: GitHub Discussions
- ⭐ Star the repo if you find it useful!
SpacingJS is released under the MIT License.