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

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

问题描述

是否有可能在HTML中写下如下内容:

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

这个想法是将字符串属性分成不同的行来提高可读性。 b

解决方案

是的,这是可能的:
https:// stackoverflow.com/a/38874964/3135511
秘诀在于使用标签代替空格
以及use linebreaks



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


^ - 尝试将代码悬停在 ....
然后寻找链接 - 它应该像
一样阅读bla bla bla bla bla bla bla bla bla bla bla bla bla



背景:


  • 字符串中的空格将被转义为%20,所以s tay in,
    +,但空格为标签& > line break 将被丢弃/过滤掉。



    如果你想让它们在一个字符串中写%09 %0A%0D ,某些CR / LF窗口换行符为c $ c>。 - > 这是两个字节一个
    C 载体 R eturn char和一些 L strong> eed char。



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.

解决方案

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>

^- 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

Background:

  • 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.

    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天全站免登陆