<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: carollin rolling</title>
    <description>The latest articles on DEV Community by carollin rolling (@carollin_rolling_a3f2b9ed).</description>
    <link>https://dev.to/carollin_rolling_a3f2b9ed</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4201833%2F6f5a1dac-5f46-405f-a0b6-69af5980347f.png</url>
      <title>DEV Community: carollin rolling</title>
      <link>https://dev.to/carollin_rolling_a3f2b9ed</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/carollin_rolling_a3f2b9ed"/>
    <language>en</language>
    <item>
      <title>Getting an AI Image to Work in a Website Hero</title>
      <dc:creator>carollin rolling</dc:creator>
      <pubDate>Mon, 26 Oct 2026 10:13:54 +0000</pubDate>
      <link>https://dev.to/carollin_rolling_a3f2b9ed/getting-an-ai-image-to-work-in-a-website-hero-537j</link>
      <guid>https://dev.to/carollin_rolling_a3f2b9ed/getting-an-ai-image-to-work-in-a-website-hero-537j</guid>
      <description>&lt;p&gt;Generate a wide image, put a headline over it, then open the page on your phone.&lt;/p&gt;

&lt;p&gt;The cup is cropped out. The empty space is gone. The headline now sits over the busiest part of the picture.&lt;/p&gt;

&lt;p&gt;A 16:9 image gives you a starting shape. The layout determines how much of it anyone actually sees. That is worth figuring out before spending an afternoon rewriting prompts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Give the image a job in the layout
&lt;/h2&gt;

&lt;p&gt;Take a simple landing page: headline on the left, a ceramic coffee cup on the right, one button below the copy.&lt;/p&gt;

&lt;p&gt;Before generating the image, put the actual headline and button into a rough layout. Use a solid rectangle for the image if necessary. You want to know where the text ends and where the cup can begin.&lt;/p&gt;

&lt;p&gt;This matters more than it sounds. “Leave space on the left” could mean room for a short heading. Your page might need room for a three-line heading, a description, and two buttons.&lt;/p&gt;

&lt;p&gt;For this example, the image brief could be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cup in the right third of the frame.&lt;/li&gt;
&lt;li&gt;Left half reserved for text.&lt;/li&gt;
&lt;li&gt;Warm, low-detail background.&lt;/li&gt;
&lt;li&gt;No lettering or decorative objects behind the copy.&lt;/li&gt;
&lt;li&gt;Mobile layout places the copy above the image.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last decision takes some pressure off the image. It only needs to support overlapping text on wider screens.&lt;/p&gt;

&lt;h2&gt;
  
  
  Put those constraints into the prompt
&lt;/h2&gt;

&lt;p&gt;A scene prompt might look like this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A ceramic coffee cup on a wooden desk, warm morning light, realistic photography.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There is nothing in that request about a website. A centered cup, a plant on the left, and a sharply defined window frame would all fit the description.&lt;/p&gt;

&lt;p&gt;Here is a more useful brief for our layout:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Wide photograph for a website hero, 16:9. A cream ceramic coffee cup on a pale wooden desk, positioned in the right third. Warm morning light from the right. The left half shows a plain, softly lit beige wall with very little texture, reserved for a headline and button. Keep the cup fully inside the frame. No lettering, logos, plants, or extra desk objects.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The useful details are spatial: where the cup goes, what sits behind the text, and which objects would get in the way.&lt;/p&gt;

&lt;p&gt;The model may ignore some of them. Treat the output as a draft.&lt;/p&gt;

&lt;p&gt;When reviewing it, use the page mockup. If the cup overlaps the copy, ask for a position change. If a window frame cuts through the letters, remove the window frame. Keep revisions specific enough that you can tell whether they helped.&lt;/p&gt;

&lt;p&gt;Changing the subject position, lighting, palette, and camera angle at once makes that harder.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understand what &lt;code&gt;cover&lt;/code&gt; will crop
&lt;/h2&gt;

&lt;p&gt;Suppose the source image is 1600 × 900, and the mobile image box is 400 × 500.&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;object-fit: cover&lt;/code&gt;, the image scales to roughly 889 × 500 to fill the box without distortion. The box shows about 45% of the image’s width.&lt;/p&gt;

&lt;p&gt;That is a lot of composition to lose. The cup and the space beside it might simply be too far apart to survive together.&lt;/p&gt;

&lt;p&gt;For an &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; element, &lt;code&gt;object-position&lt;/code&gt; lets you adjust which area remains visible:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.hero__image&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;block&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;clamp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;20rem&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;40vw&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;36rem&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;object-fit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;cover&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;object-position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;75%&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;75% center&lt;/code&gt; favors the right-hand portion when there is horizontal cropping. It does not detect the cup or guarantee that the whole cup stays visible. MDN explains how &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/object-fit" rel="noopener noreferrer"&gt;object-fit&lt;/a&gt; and &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/object-position" rel="noopener noreferrer"&gt;object-position&lt;/a&gt; interact.&lt;/p&gt;

&lt;p&gt;For our example, the mobile design already puts the copy above the image. We can let the image keep its natural proportions there:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;48rem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.hero__image&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This snippet handles the image sizing; the surrounding component still needs to arrange the copy and image at that breakpoint.&lt;/p&gt;

&lt;p&gt;If the mobile design requires a tall image, a separate composition may be a better fit. Decide that from the layout rather than repeatedly trying to generate a landscape image that tolerates every possible crop.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check the background behind the actual letters
&lt;/h2&gt;

&lt;p&gt;A quiet background helps, but it does not establish sufficient contrast by itself.&lt;/p&gt;

&lt;p&gt;Pale beige can look restrained and still be a poor background for white text. A dark image can contain one reflection that makes a few words difficult to read.&lt;/p&gt;

&lt;p&gt;Check the parts of the image directly behind the heading, description, and button label. Repeat after changing the crop.&lt;/p&gt;

&lt;p&gt;For normal-size text, WCAG’s minimum contrast requirement is 4.5:1. The &lt;a href="https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html" rel="noopener noreferrer"&gt;W3C explanation&lt;/a&gt; covers the criterion and its exceptions.&lt;/p&gt;

&lt;p&gt;An overlay is one option. Putting the copy on a solid background is another. If the design needs several layers of fixes to make the heading readable, revisit the composition.&lt;/p&gt;

&lt;p&gt;Keep the heading and button in HTML, too. Copy changes and translations are much easier when they do not require a new image.&lt;/p&gt;

&lt;h2&gt;
  
  
  Review the asset in the browser before calling it finished
&lt;/h2&gt;

&lt;p&gt;Use the real headline. Resize slowly through the widths between your usual desktop and mobile previews. Check what happens when the heading wraps onto another line.&lt;/p&gt;

&lt;p&gt;Then look at the image at its displayed size. A distorted cup handle may be obvious there, even if it was easy to miss in a thumbnail. Conversely, tiny background details may have no bearing on the finished page.&lt;/p&gt;

&lt;p&gt;For accessibility, decide what the image contributes. A purely decorative &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; should use &lt;code&gt;alt=""&lt;/code&gt;. An image that communicates additional information needs an appropriate text alternative. W3C’s &lt;a href="https://www.w3.org/WAI/tutorials/images/decorative/" rel="noopener noreferrer"&gt;decorative image guidance&lt;/a&gt; explains that distinction.&lt;/p&gt;

&lt;p&gt;Save the composition brief with the selected asset. When the headline gets longer or the layout changes, you will have something more useful to revise than “make it look better.”&lt;/p&gt;

&lt;p&gt;For a hero section, the browser is where the image earns its place. Approve it there.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
