Maison > interface Web > tutoriel HTML > le corps du texte

用一个Div显示大段文本需要做那些设置?_html/css_WEB-ITnose

WBOY
Libérer: 2016-06-24 12:14:19
original
1089 Les gens l'ont consulté

在一个小应用中,我需要在页面显示大段文本,文本可能很长,最多有五万字左右。

首先,原有文本格式需要保持,比如空格,空行,回车,TAB等。
其次,一段文本如果较长,需要自动换行,不能把DIV乃至外面的容器撑开。
其三,文本中如果有特殊字符,如引号,HTML代码等也要能正常显示。

目前我再DIV中试用PRE标签1,3倒是可以做到,但第二点不能。
请问我还需要增加什么设置?


回复讨论(解决方案)

是你的样式问题~用了浮动后,最后记得清楚浮动就可以了~

#body_content DIV.down{	background-image: url("../images/content_down.png");	background-repeat: no-repeat;	width:986px;	height:98px;	margin:0;	float:left;}#body_content DIV.down{	background-image: url("../images/content_down.png");	background-repeat: no-repeat;	width:986px;	height:98px;	margin:0;	float:left;}#body_content DIV.center{	background-image: url("../images/content_center.png");	background-repeat: repeat-y;	width:986px;	margin:0;	float:left;}#body_content DIV.up{	background-image: url("../images/content_up.png");	background-repeat: no-repeat;	width: 986px;	height: 105px;	margin: 0;	padding: 0;	float:left;}#area_footer{	width:100%;	height:80px;	padding:50 0 0 0;	clear:both;}
Copier après la connexion

不好意思回复错了~

你的问题,解决方案:
给外层div定宽,文本用p标签写,一个段落用一个p标签;

Copier après la connexion
Copier après la connexion

这样就可以了~

不好意思回复错了~

你的问题,解决方案:
给外层div定宽,文本用p标签写,一个段落用一个p标签;

Copier après la connexion
Copier après la connexion

这样就可以了~

无效啊。

可以用一个隐藏边框,背景透明的textarea显示的,代码如下:


使用$("XXX").value="...";设置值就行。

用textarea可行。

source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!