: Hiding the text that is already shown in a preview image I've got a page, in which I have a preview of a document, as JPG. Also, I've got the content read of that image. I am doing it
I've got a page, in which I have a preview of a document, as JPG. Also, I've got the content read of that image.
I am doing it like this, but I have no idea if this is a way Google won't hate me:
<div class="image-container">
<img src="preview.doc.jpg" />
<hidden style="display:none">
Lots of text which is in preview.doc, but the image above actually
says this text, but as an image because a word document
cannot be shown in a browser,
but it's alot which I do not want to show to the user because the data in here is actually rendered nicely above
as a word document with all styling.
</hidden>
</div>
Is this the way to do it, or should I do it in another way?
More posts by @Frith620
2 Comments
Sorted by latest first Latest Oldest Best
It looks a bit long, but I suppose you could just drop it into the image's alt attribute.
<div class="image-container">
<img
src="preview.doc.jpg"
alt="Lots of text which is in preview.doc, but the image above actually says this text, but as an image because a word document cannot be shown in a browser, but it's alot which I do not want to show to the user because the data in here is actually rendered nicely above as a word document with all styling."
/>
</div>
It's a bit tough not knowing the purpose of keeping the .DOC (instead of just pasting/formatting the content online) but this wouldn't be entirely out of the realm of use of alt attributes.
Unconventional? Sure. Better than a hidden DIV? I'd say almost certainly.
If you want to follow best practice as far as Google's Guidelines are concerned, you should be showing everyone the exact same content - users and bots alike.
An alternative would be to place the content in HTML on the page, underneath the image, but use an accordion / dropdown / click to expand type thing so that the text would be "hidden" unless clicked on and won't affect the UX of the page.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2025 All Rights reserved.