Reputation: 385
I'm trying to display the content of a text file in html without using ajax, javascript ecc. but possibly css and html. I have a slideshow of images and depending on the image you select, the content of the text file should appear under the photo. I know how to associate the text file with the photo and it should work, but how can I can display the content of the txt file in the web page? Thanks :-)
Upvotes: 3
Views: 36972
Reputation: 838
Alternatively to an iframe the tag does the trick well.
nikolay_turpitko's answer to a similar question does it quite well
[Below is his answer copied directly]
In more recent browsers code like below may be enough.
<object data="https://www.w3.org/TR/PNG/iso_8859-1.txt" width="300" height="200">
Placeholder Text
</object>
Upvotes: 3
Reputation: 14152
You can just use an <iframe>
:
<iframe src="http://stackoverflow.com/reputation"></iframe>
Edit: Stack Overflow no longer allows
<iframe>
's to a different domain, so I switched to using//stackoverflow.com/reputations
for the demos
This is probably more what you are looking for(Image with text below it):
iframe{
border:none;
width:400px;
display:block;
}
<img src="http://lorempixel.com/400/400">
<iframe src="http://stackoverflow.com/reputation"></iframe>
Upvotes: 8