C#将HTMl 赋给字符串
string aaa = "<div id="demo" ><span style="color:red;"><h1>Hello World! </h1></span> </div> ";
这样写怎么会报错 怎么才能将HTML 赋给string
------解决方案--------------------双引号转义啊,基础知识!
" --> \"
------解决方案--------------------双引号前加\ 变成\"
------解决方案--------------------string aaa = "<div id=\"demo\" ><span style=\"color:red;\"><h1>Hello World! </h1></span> </div> ";
------解决方案--------------------或者把双引号改成单引号也行
------解决方案--------------------基础知识啊,加转义符。
string aaa = "<div id=\"demo\" ><span style=\"color:red;\"><h1>Hello World! </h1></span> </div> ";
------解决方案--------------------html 里面用单引号比较好
------解决方案--------------------string aaa = "<div id=\"demo\" ><span style=\"color:red;\"><h1>Hello World! </h1></span> </div> ";
------解决方案--------------------string aaa ="<div id='demo' ><span style='color:red;'><h1>Hello World! </h1></span> </div> ";
------解决方案--------------------双引号用:\"
string aaa = "<div id=\"demo\" ><span style=\"color:red;\"><h1>Hello World! </h1></span> </div> ";
------解决方案--------------------