将 html 作为字符串复制到 visual studio 2017
copy html as string to visual studio 2017
我正在用视觉代码编写 html。
示例:
<header>
<h1 style="text-align: center">Customer Name: 0</h1>
<h2 style="text-align: center">Year: 2001 ,month: 12</h2>
<h3 style="text-align: center">Total price: 100</h3>
</header>
我想将代码复制粘贴到 visual studio 2017
但在 visual studio 中看起来像:
"<header>
< h1 style = "text-align: center" > Customer Name: 0 </ h1 >
< h2 style = "text-align: center" > Year: 2001 ,month: 12 </ h2 >
< h3 style = "text-align: center" > Total price: 100 </ h3 >
</ header > "
怎么贴成这样?
"<!DOCTYPE html><html><head><title></title></head><body><header>
首先你需要在线格式化你的 Html 并将其转换成单行格式
使用
Www.textfilter.com
并且将双引号转换为单引号
其次,当你在 visual studio 中使用它时,如果将它放在字符串变量中,你需要在你的字符串
后面添加 @
string myhtmlstring = @"myanyhtmtags";
这将防止转义并且有效
我正在用视觉代码编写 html。 示例:
<header>
<h1 style="text-align: center">Customer Name: 0</h1>
<h2 style="text-align: center">Year: 2001 ,month: 12</h2>
<h3 style="text-align: center">Total price: 100</h3>
</header>
我想将代码复制粘贴到 visual studio 2017
但在 visual studio 中看起来像:
"<header>
< h1 style = "text-align: center" > Customer Name: 0 </ h1 >
< h2 style = "text-align: center" > Year: 2001 ,month: 12 </ h2 >
< h3 style = "text-align: center" > Total price: 100 </ h3 >
</ header > "
怎么贴成这样?
"<!DOCTYPE html><html><head><title></title></head><body><header>
首先你需要在线格式化你的 Html 并将其转换成单行格式
使用
Www.textfilter.com
并且将双引号转换为单引号
其次,当你在 visual studio 中使用它时,如果将它放在字符串变量中,你需要在你的字符串
后面添加@
string myhtmlstring = @"myanyhtmtags";
这将防止转义并且有效