Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Place the image and its text inside the same wrapper, make the wrapper position: relative, then position the text over it with position: absolute. For a responsive image area, give the wrapper a size or aspect ratio and use object-fit: cover on the image; adjust object-position if the crop hides the subject. This keeps the caption as real, selectable HTML text rather than baking it into the image.
Build a basic image-and-caption overlay
The key is a shared positioning context. The wrapper defines the area the caption is positioned against, while the image fills that area. The following pattern creates a wide hero image with text anchored along its lower edge:
<figure class="hero">
<img src="mountains.jpg" alt="Snow-covered mountains at sunrise">
<figcaption class="hero__caption">
<h1>Find your next trail</h1>
<p>Explore routes for every season.</p>
</figcaption>
</figure>
.hero {
position: relative;
overflow: hidden;
aspect-ratio: 16 / 9;
margin: 0;
}
.hero img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
}
.hero__caption {
position: absolute;
inset: auto 0 0;
padding: clamp(1rem, 4vw, 3rem);
color: white;
background: linear-gradient(transparent, rgb(0 0 0 / 0.75));
}
The image and figcaption are siblings inside the figure, so the caption can overlay the image without becoming part of the image file. The wrapper’s position: relative establishes the containing block for the absolutely positioned caption. Positioned-layout behavior is described in MDN’s CSS positioned layout reference.
Recommended Free Tools
The aspect-ratio sets the wrapper’s shape. The image’s width and height make it fill that box, and object-fit: cover fills it while preserving the image proportions. That can crop the image. overflow: hidden clips anything extending beyond the wrapper’s edges; remove it if you want content to extend outside the frame. See MDN’s references for object-fit and object-position.
#1 Best Overall
- Wacom Intuos Small Graphics Drawing Tablet: Enjoy industry leading tablet performance in superior control and precision with Wacom's EMR, battery free technology that feels like pen on paper
- Works With All Software: Wacom Intuos tablet can be used in any software program to explore new facets of digital creativity; draw, paint, edit photos/videos, create designs, and mark up documents
- What the Professionals Use: Wacom's industry leading pen technology and pen to paper feeling makes it the preferred drawing tablet of professional graphic designers
- Software and Training Included: Only Wacom gives you software with every purchase. Register your Intuos tablet and gain access to some of the best creative software and Wacom's online training
- Wacom is the Global Leader in Drawing Tablet and Displays: For over 40 years in pen display and tablet market, you can trust that Wacom to help you bring your vision, ideas and creativity to life
Choose the image fit and crop
The right fit depends on whether filling the frame or showing every part of the image matters more. object-fit controls how the image content fits its box; it does not change the dimensions of the box itself.
| Value | What it does | When to use it |
|---|---|---|
cover |
Fills the box while preserving image proportions; some edges can be cropped. | Use for hero images and cards where filling a fixed frame matters more than retaining every edge. |
contain |
Shows the complete image while preserving its proportions; unused space may remain in the box. | Use when the whole image must stay visible, such as a diagram or product image where cropped details would be misleading. |
The image’s default position in this example is centered. If a face, product, or other focal point is cut off, set a different object-position, such as object-position: 65% center;, to shift which part remains visible. The percentages are a CSS positioning choice, not a promise that the same crop will look right for every source image. Check the actual result at the sizes your layout uses.
Rank #2
- Word-first 16K Pressure Levels: The upgraded stylus features 16,384 levels of pressure sensitivity and supports up to 60 degrees of tilt, delivering smoother lines and shading for a natural drawing experience. With no battery or charging needed, it operates like a real pen, making it easy for beginners to create effortlessly. This functionality helps novice artists develop their skills and explore their creativity without the intimidation of complex tools
- Designed for Beginners: This drawing pad desinged with 8 customizable shortcuts for both right and left-hand users, express keys create a highly ergonomic and convenient work platform
- Perfectly Adapted for Android: The XPPen Deco 01 V3 art tablet supports connections with Android devices running version 10.0 and above. It is recommended to download the XPPen Tools Android application, which adapts to your smartphone's screen aspect ratio, ensuring accurate mapping. It also supports mapping on Android screens with different aspect ratios in portrait mode
- Large Drawing Space, Bigger Bold Inspiration: This expansive drawing pad has10 x 6.25-inch helps you break through the limit between shortcut keys and drawing area
- Easy Connectivity for Beginners: The Deco 01 V3 offers USB-C to USB-C connectivity, plus adapters for USB C. This ensures easy connection to various devices, allowing beginner artists to set up quickly and focus on their creativity without compatibility concerns. Whether using a laptop, tablet, or desktop, the Deco 01 V3 provides a seamless experience, making it an ideal choice for those just starting their digital art journey
Move or center the caption
The example pins the caption to the bottom by setting the bottom inset to zero and leaving the other inset values automatic. To put text in the exact center instead, replace the caption’s positioning rules with:
.hero__caption {
position: absolute;
inset: 50% auto auto 50%;
transform: translate(-50%, -50%);
text-align: center;
width: min(90%, 40rem);
color: white;
}
The inset places the caption’s top-left corner at the center of the wrapper; the transform moves it back by half its own width and height. The width limit gives the text a wrapping boundary. For a left-aligned overlay, anchor it to a side instead—for example, use inset: 0 auto 0 0 and add padding. Keep the positioning values on the caption, not the image, so changing caption placement does not change the image crop.
Rank #3
- Customize Your Workflow: The 6 customizable press keys on Huion H640P drawing tablet for pc let you assign your most-used commands—like undo, zoom, brush switch, or save—so you can keep your hands on the tablet and your mind on the art. Whether you're a digital painter switching brushes, or a comic artist zooming in and out, these keys keep your workflow smooth and uninterrupted. Plus, the Huion driver lets you save different shortcut profiles for different apps, so you never have to reconfigure when switching software.
- Professional Pen Performance: Huion H640P drawing pad for computer comes with the battery-free PW100 stylus that's always ready when inspiration strikes. With 8192 levels of pressure sensitivity, every light sketch, or bold stroke responds naturally to your hand—just like a real pen. The 5080 LPI resolution and 233 PPS report rate deliver lag-free, precise strokes, so you can draw confidently without second-guessing your cursor. The pen side buttons help you switch between pen and eraser instantly.
- Compact and Portable: Huion H640P computer graphics tablet features a compact, ultra-portable design at just 0.3 inches thin and 0.61 lbs light, so it slides easily into your backpack—perfect for sketching in coffee shops, taking notes in class, or editing on the go between home and studio. The 6x4 inch active area offers enough room for natural pen movements while fitting comfortably on crowded desks, or lecture hall seats.
- Stable Compatibility: Huion H640P graphic drawing tablet works seamlessly with Mac, Windows, Linux PCs, and Android smartphones/tablets (OS version 6.0 or later). Left-handed friendly, and you just need to flip the tablet and adjust the settings in the driver. Please note: H640P does NOT support iPhone/iPad.
- Move Beyond the Mouse: Huion Inspiroy H640P is a pen tablet that replaces your mouse for more natural, precise control. Freehand draw, take notes, or even play OSU—everything you do with a mouse, you can do better with a pen. The precise tip makes it ideal for detailed photo editing, graphic design, or signing PDF. Meanwhile, the ergonomic pen grip helps you avoid the strain that comes from hours of using a mouse.
Make the overlay work on narrow screens
Absolute positioning removes the caption from normal document flow. It does not make room for the caption by itself, so long copy can crowd the image or run out of space in a short frame. Keep the overlay brief, allow it to wrap, and inspect both the crop and text at narrow and wide viewport sizes. A flexible padding value such as clamp() helps avoid using the same large inset on every screen, but it cannot guarantee that every caption fits over every image.
If the text needs more room than the image can provide, move it below the image at a small-screen breakpoint rather than forcing it over the subject. One approach is to change the caption from an overlay to a normal-flow block:
Rank #4
- PLEASE NOTE:XPPen Artist13.3 Pro drawing tablet Need to connect with computer,you need to use it with your computer or laptop, the 3 in 1 cable is included
- Drawing Tablet with Screen: Tilt Function- XPPen Artist 13.3 Pro supports up to 60 degrees of tilt function, so now you don't need to adjust the brush direction in the software again and again. Simply tilt to add shading to your creation and enjoy smoother and more natural transitions between lines and strokes
- Graphics Tablets: High Color Gamut- The 13.3 inch fully-laminated FHD Display pairs a superb color accuracy of 88% NTSC (Adobe RGB≧91%,sRGB≧123%) with a 178-degree viewing angle and delivers rich colors, vivid images, and dazzling details in a wider view. Your creative world is now as powerful as it is colorful
- Drawing Pad: One is enough- The sleek Red Dial on the display is expertly designed with creators in mind, its strategic placement allows for natural drawing postures. With just one wheel, you can effortlessly zoom in and out, adjust brush sizes, and flip the canvas—all tailored to suit the habits of everyday artists. The 8 customizable shortcut keys allow you to personalize your setup, streamlining your workflow and enhancing creative efficiency
- Universal Compatibility & Software Support:supports Windows 7 (or later), Mac OS X 10.10 (or later), Chrome OS 88 (or later), and Linux systems. Fully compatible with major creative software including Photoshop, Illustrator, SAI, and Blender 3D. Register your device to access additional programs like ArtRage 5 and openCanvas for expanded creative possibilities.
@media (max-width: 40rem) {
.hero {
aspect-ratio: auto;
overflow: visible;
}
.hero img {
height: auto;
}
.hero__caption {
position: static;
color: inherit;
background: none;
padding: 1rem 0;
}
}
Here, position: static returns the caption to normal flow. Setting the wrapper’s ratio to auto and the image height to auto lets the image use its natural proportions instead of forcing it into the earlier fixed-ratio frame. Choose the breakpoint based on when your actual text and image stop fitting comfortably; no single width works for every design.
Keep image text accessible and readable
Use live HTML for the overlay copy. Visitors can select and resize it, and assistive technologies can interpret it as text. Give an informative image alternative text that describes relevant image information; if an image is decorative and nearby text already conveys the same information, use alt="". MDN explains the <img> element and its alternative text and provides a guide to using images in HTML.
Best Value
- Battery-Free Pen: StarG640 drawing tablet is the perfect replacement for a traditional mouse! The XPPen advanced Battery-free PN01 stylus does not require charging, allowing for constant uninterrupted Draw and Play, making lines flow quicker and smoother, enhancing overall performance
- Ideal for Online Education: XPPen G640 graphics tablet is designed for digital drawing, painting, sketching, E-signatures, online teaching, remote work, photo editing, it's compatible with Microsoft Office apps like Word, PowerPoint, OneNote, Zoom, Xsplit etc. Works perfect than a mouse, visually present your handwritten notes, signatures precisely
- Compact and Portable: The G640 art tablet is only 2 mm thick, it's as slim as all primary level graphic tablets, allowing you to carry it with you on the go
- Chromebook Supported: XPPen G640 digital drawing tablet is ready to work seamlessly with Chromebook devices now, so you can create information-rich content and collaborate with teachers and classmates on Google Jamboard’s whiteboard; Take notes quickly and conveniently with Google Keep, and effortlessly sketch diagrams with the Google Canvas
- Multipurpose Use: Designed for playing OSU! Game, digital drawing, painting, sketch, sign documents digitally, this writing tablet also compatible with Microsoft Office programs like Word, PowerPoint, OneNote and more. Create mind-maps, draw diagrams or take notes as replacement for mouse
White text over a variable photograph may be hard to read. A dark gradient beneath bottom-aligned text or a translucent panel behind the copy can make the background more consistent, but neither technique removes the need to inspect the real image and text together. Avoid putting important words over busy details when a clearer region is available. Check line wrapping and legibility at the image’s different crops and viewport sizes; a styling trick alone is not proof that the text is readable.
Troubleshoot common overlay problems
- The caption appears below the image. Confirm that the caption is inside the same wrapper as the image and that the caption has
position: absolute. Confirm that the wrapper hasposition: relativeso the caption is positioned against the intended area. - The image does not fill the frame. Check that the wrapper has a defined size or aspect ratio and that the image has both
width: 100%andheight: 100%. Useobject-fit: coverto fill it, orcontainif the complete image matters more. - The subject is cut off. With
cover, cropping is expected when the image and box proportions differ. Adjustobject-positionto favor the subject, change the wrapper’s aspect ratio, or usecontainto show the whole image at the cost of unused space. - The overlay is clipped. The example deliberately uses
overflow: hiddento clip the contents at the wrapper boundary. Remove that rule if the caption or another element needs to extend beyond the frame. - The text is crowded or hard to read. Shorten it, give it a constrained width and enough padding, reposition it over a less busy part of the image, or move it below the image at a narrow-screen breakpoint. Check the actual crop and wrapping rather than assuming one desktop preview is sufficient.
Or skip the browser setup
If your page is already available at a URL and you need an image of its rendered result, ScreenshotNeo can capture it with one GET request. This is for capturing a webpage; it does not replace the HTML and CSS work above. ScreenshotNeo is a website screenshot API and MCP server from Yorker Media. Its clean-shot flow accepts consent banners and removes supported consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Its responses identify page verdict and billing status, and clean shots alone are billed. An MCP server exposes screenshot tools to AI agents. See ScreenshotNeo and the API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Replace YOUR_API_KEY with your key and replace the example URL with the URL of your published page. The request saves the returned capture as shot.webp. ScreenshotNeo also offers an MCP server for AI agents that need screenshot tools. Its Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for the free plan and get 1,000 screenshots a month with no card.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Frequently Asked Questions
Can I use this technique with a background image instead of an img element?
Yes, but this pattern uses an img element because it keeps the image’s alternative text available in HTML. Use a CSS background image when the image is decorative and does not need to be conveyed as meaningful content; do not rely on background imagery to provide the only accessible description of important information.
Can I put a button or link in the overlay?
Yes. Put the link or button in the caption markup and style it as ordinary interactive HTML. Make sure the image crop, caption positioning, and surrounding layout leave the control visible and usable.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

