Skip to content

Is display:none content indexed? Hidden text and crawlers

Can crawlers read text hidden with display:none, visibility or off-screen CSS? Why it is still in the HTML, what Google's spam policy allows, and how to check it.

By Crawlito · 6 min read

In short

  • Text hidden with CSS, such as display:none, visibility:hidden or off-screen positioning, is still in the HTML, so crawlers that read raw HTML receive it.
  • Google's spam policies say accordions, tabs, sliders, tooltips and screen-reader-only text are not hidden text abuse when they improve the experience for people.
  • Hiding keywords or links that visitors are never meant to see, with white text, zero font size or off-screen CSS, is listed by Google as hidden text abuse.
  • AI crawler operators do not document how they weigh CSS-hidden text, so put the content you most want read in visible text.
  • The real risk is content that is not in the HTML at all until a click or scroll triggers a request, not content that CSS hides.
On this page

Yes, crawlers can read text hidden with CSS. display: none, visibility: hidden, off-screen positioning and collapsed accordions only change how a browser draws the page; the text is still in the HTML the server sends. Google's spam policies explicitly say that tabs, accordions, sliders, tooltips and screen-reader text are fine. Hiding text is only a problem when it exists to manipulate search engines and visitors are never meant to see it.

The distinction that matters for AI search is between content that is hidden and content that is absent. Hidden content is delivered. Content that only arrives after a click or scroll may never be fetched by a crawler at all.

Why CSS-hidden text is still in the HTML

A browser builds a page in two steps: it parses the HTML into a document, then applies CSS to decide what to draw. Hiding with CSS happens in the second step. The text stays in the document.

A crawler that does not render the page never applies CSS, and most AI crawler operators do not document rendering at all (see do AI crawlers run JavaScript). It sees this:

html
<div class="tab-panel" style="display:none">
  <h3>Delivery times</h3>
  <p>Orders placed before 2pm ship the same working day.</p>
</div>

and gets the heading and paragraph as plain text, exactly like visible content. It has no way to know the panel is collapsed unless it evaluates the stylesheet.

A crawler that renders the page, such as Googlebot, builds the full layout and can tell which text is visible. Google's spam policy shows it pays attention to the difference, because it describes when hiding is acceptable and when it is abuse.

Which hiding methods keep text in the HTML

MethodVisible to peopleIn the raw HTMLRead by assistive tech
display: noneNoYesNo
visibility: hiddenNo (space is kept)YesNo
hidden attributeNoYesNo
<details> closedSummary onlyYesSummary only until opened
Off-screen (left: -9999px)NoYesYes
Visually hidden "sr-only" classNoYesYes
opacity: 0NoYesYes
aria-hidden="true"YesYesNo
Loaded by JavaScript on clickOnly after clickNoOnly after click

Everything in that table except the last row delivers the text in the server's response. The last row is the one that causes missing content. Our guide to lazy loaded tabs and accordions covers that pattern and how to test it.

What Google's spam policy allows and forbids

Google's spam policies define hidden text and link abuse as placing content on a page in a way solely to manipulate search engines and not to be easily viewable by human visitors. The examples it lists:

  • White text on a white background
  • Text hidden behind an image
  • CSS that positions text off-screen
  • Font size or opacity set to 0
  • A link on a single small character, such as a hyphen in a paragraph

The same section then says that many web designs show and hide content dynamically to improve the experience, and that these are not considered abuse:

  • Accordion or tabbed content that toggles between hiding and showing
  • Slideshows or sliders that cycle through images or text
  • Tooltips that show more content when users interact with an element
  • Text that is only accessible to screen readers to improve their experience

Notice that the technique is not what decides it. "CSS that positions text off-screen" appears in the abuse list, and screen-reader-only text, which usually uses exactly that technique, appears in the allowed list. The test is intent and audience: is the hidden text there for people who will reach it, or only for crawlers?

Patterns that cross the line

  • A block of keyword-stuffed text at the bottom of a page in a hidden div
  • A list of city names hidden off-screen on a service page
  • Links to unrelated pages inside a zero-height container
  • Text that only appears when the user agent is a crawler, which is cloaking rather than hidden text. See serving AI crawlers different content.

If you would be uncomfortable showing the hidden text to a visitor, it should not be there.

How AI crawlers treat hidden text

OpenAI, Anthropic and Perplexity do not document how their crawlers or retrieval systems treat text hidden with CSS. Since most of them are not documented as rendering pages, the practical assumption is that they receive hidden text as ordinary text, with no signal that it was collapsed.

That has two consequences:

  1. Collapsed content can be used. FAQ answers inside accordions, specifications in tabs and policy details in expandable sections are delivered to non-rendering crawlers in full.
  2. Junk hidden text is also delivered. Hidden navigation for another breakpoint, duplicated mobile and desktop menus, cookie banner copy and visually hidden keyword blocks all end up in the extracted text. Duplicate blocks make a page noisier to read for any system that extracts text from HTML.

Because none of this is documented, the safe approach is simple: put the main answer of the page in visible text near the top, and use collapsible sections for supporting detail.

Responsive designs that duplicate content

A common source of hidden text is responsive templates that render two versions of the same block and hide one with media queries:

html
<nav class="menu-desktop">...</nav>
<nav class="menu-mobile">...</nav>

<style>
  @media (max-width: 768px) { .menu-desktop { display: none; } }
  @media (min-width: 769px) { .menu-mobile { display: none; } }
</style>

Both menus are in the HTML for every visitor and every crawler. That is not abuse, but on large sites it can double the amount of boilerplate a crawler reads before reaching the content. Where possible, use one block of HTML and change its layout with CSS.

The opposite problem is more serious: content that is removed from the mobile HTML entirely. Google indexes the mobile version of pages, so text that only exists in the desktop HTML may not count. See mobile and desktop content parity.

How to check whether hidden content is in the HTML

Fetch the raw HTML and search for a sentence from the hidden section:

bash
curl -s -A "Mozilla/5.0 (compatible; GPTBot/1.4; +https://openai.com/gptbot)" \
  https://www.example.com/product/widget \
  | grep -c "ship the same working day"

A count of 1 or more means the text is delivered without JavaScript. A 0 means it is either loaded later by a script or not on the page at all.

Then compare with the rendered page:

  1. Open the page in Chrome, open DevTools and search the Elements panel (Ctrl+F or Cmd+F) for the same sentence. If it appears in Elements but not in the curl output, JavaScript added it.
  2. Check the collapsed state. Select the element and look at the Computed styles for display or visibility to confirm how it is hidden.
  3. For Google, use the URL Inspection tool in Search Console and view the crawled HTML. The URL Inspection tool and rendered HTML explains what each view shows.

Finally, read the hidden text itself. If any of it is there only for search engines, remove it.

How to fix common problems

ProblemFix
Accordion content loaded by fetch() on clickRender the content into the HTML on the server and toggle it with CSS or <details>
Key answer only inside a collapsed sectionMove a one or two sentence answer into visible text above the accordion
Duplicate mobile and desktop blocksUse one block with responsive CSS
Hidden keyword or link blocksDelete them
Screen-reader-only text that repeats visible headingsKeep it only where it adds context assistive tech needs

The native <details> and <summary> elements are a good default for expandable content. They work without JavaScript, the content is in the HTML, and the browser handles the toggle.

html
<details>
  <summary>What is your returns policy?</summary>
  <p>You can return unused items within 30 days for a full refund.</p>
</details>

Frequently asked questions

Does Google index text hidden with display:none?

Google's spam policies treat accordions and tabs that hide content until a user interacts as compliant, so content in such components is not a problem in itself. Text hidden only to manipulate rankings is listed as spam.

Can ChatGPT or Perplexity read content in collapsed accordions?

If the content is in the HTML the server sends, a crawler that reads raw HTML receives it. OpenAI and Perplexity do not document how they treat CSS-hidden text, so keep the main answer visible.

Is screen-reader-only text considered hidden text?

Google's spam policies list text that is only accessible to screen readers, used to improve their experience, as not being hidden text abuse. Use it for accessibility, not for adding keywords.

Is content in a hidden tab worth less than visible content?

Google does not document a reduced weight for content in tabs or accordions. AI crawler operators do not document anything either way, so visible placement remains the safer choice for your most important text.

See what crawlers receive from your page

Hidden content is rarely the problem; content that never reaches the HTML is. To see the text AI crawlers receive from one of your pages, without JavaScript, run the free check.

Filed under Rendering and content. Topics: html, rendering, google, raw-html, content