多行字符串属性值,HTML [英] String attribute values in multiple lines, HTML

查看:28
本文介绍了多行字符串属性值,HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 HTML 中编写如下内容:

Is it possible, in HTML to write something like:

<a href="bla bla bla bla
        bla bla bla bla">....</a>

这个想法是将一个字符串属性拆分成不同的行以提高可读性.

The idea is splitting a string attribute in different lines to improve readability.

推荐答案

是的,这是可能的:https://stackoverflow.com/a/38874964/3135511秘诀是使用制表符而不是空格以及使用换行符

Yes that's possible: https://stackoverflow.com/a/38874964/3135511 The secret is to use tab's instead of space As well as to use linebreaks

<a href="
	bla 
	bla bla 
	bla bla bla 
	bla bla 
	bla
	">....</a>

^- 尝试代码并将鼠标悬停在 ....并寻找链接 - 它应该读起来就像bla bla bla bla bla bla bla bla bla

^- try out the code and hover over the .... And look for the link - it should read just like bla bla bla bla bla bla bla bla bla

背景:

  • 字符串中的空格将被转义为 %20,因此留在,+but 空格作为 tab &换行符将被丢弃/过滤掉.

  • A space in a string will be escaped to %20 and so stay in, +but white spaces as tab & line break will be discarded/filtered out.

如果您希望它们在字符串中,请为 Tab 写入 %09,为某些 CR/LF 窗口换行符写入 %0A%0D.-> 那是两个字节一个Carrier R返回字符和一些Line Feed字符.

If you want them in a string write %09 for Tab and %0A%0D for some CR/LF windows line break. -> That are two bytes one Carrier Return char and some Line Feed char.

这篇关于多行字符串属性值,HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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