liveBook · Manning

Hero image

As explained in Build a Website with ChatGPT

A hero image is a prominent photo or illustration displayed across the width and usually the height of a browser window when a page is first opened.

A hero image is a large, eye-catching photo or illustration that fills a page’s width—and usually its height—when visitors first arrive. It sits in the header behind page content, helping the page make a strong first impression. section 7.3.1 section 7.6

Choose an image that fits the page topic, looks dramatic, and stays clear at a large size. Avoid pixelation, poor lighting, and busy details that make title or tagline text hard to read. For many larger screens, a 1,200-pixel-wide 16:9 image is a useful starting point. section 7.3.1

header {
    background: url('hero.jpg') no-repeat center center fixed;
    background-size: cover;
}

A hero image can be applied as the header’s CSS background. The cover setting expands the image to fill the header, while centering keeps its middle area in view. section 7.3.1

Add one to a home-page request

Ask for “a header that uses the file hero.jpg as a hero image,” then include the page title, tagline, and navigation links you want in that header. Save the image alongside the generated HTML and CSS files so the background file can be found. section 7.3.2

If text needs more contrast, darken the image with a CSS linear-gradient overlay. In rgba values, numbers closer to 0 make the overlay lighter; numbers closer to 1 make it darker. A darker overlay can preserve readability without replacing the image. section 7.4.3

Practical checks before publishing a hero image:

  • Match the subject to the page topic and use a well-composed, high-quality image. section 7.3.1
  • Keep the image large enough for the display area so browser scaling does not distort it. section 7.3.1
  • Check that headings, taglines, and navigation remain readable over the image; add a dark overlay when needed. section 7.3.1 section 7.4.3

How Build a Website with ChatGPT covers it

How deep it goes
Explains image selection, CSS background placement, prompting, and overlay darkness without advanced CSS internals.
Examples
Uses a bread-themed home page with hero.jpg, navigation links, and adjustable rgba gradient overlays.
What it assumes
Assumes no coding knowledge while supplying HTML, CSS, file-saving, and prompt guidance.
What you can do after
Operate/configure it by adding a header background image and adjusting its overlay for readable text.
How it connects
Connects headers, CSS backgrounds, linear gradients, navigation bars, page titles, and taglines.

Also explained in

Compare how 3 books explain hero image →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Website with ChatGPT. The section links point to the parts of the book it draws on.