以HTML显示文本文件 [英] Display text file in HTML

查看:51
本文介绍了以HTML显示文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在不使用ajax,javascript ecc的情况下以html显示文本文件的内容.但可能是CSS和HTML.我有图像的幻灯片显示,根据您选择的图像,文本文件的内容应出现在照片下方.我知道如何将文本文件与照片相关联,并且应该可以工作,但是如何在网页中显示txt文件的内容?谢谢:-)

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 :-)

推荐答案

您可以只使用

You can just use an <iframe>:

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

堆栈溢出不再允许< iframe> 进入其他域,因此我改用了//stackoverflow.com/reputations用于演示

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>

这篇关于以HTML显示文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆