Display text file in HTML

I am trying to display the contents of a text file in html without using ajax, javascript ecc. but maybe css and html. I have a slide show of images, and depending on the image you select, the contents of the text file should appear under the photo. I know how to link a text file with a photo and it should work, but how can I display the contents of a txt file on a web page? Thanks: -)

+3
html css text
source share
1 answer

You can simply use <iframe> :

 <iframe src="http://stackoverflow.com/reputation"></iframe> 

Edit: Stack overflow no longer allows <iframe> to another domain, so I switched to using //stackoverflow.com/reputations for demos

This is probably more than what you are looking for (image with text below):

 iframe{ border:none; width:400px; display:block; } 
 <img src="http://lorempixel.com/400/400"> <iframe src="http://stackoverflow.com/reputation"></iframe> 
+8
source share

All Articles