“ - >”时引号无与伦比在第二行

时间:2017-11-08 12:52:26

标签: razor quotation-marks

我为bootstrap popover编写数据内容,我想在格式化中保留换行符。所以我用了

.popover {
    white-space: pre-wrap;  
     max-width: 100%;  
}

但是一写“ - >”我就会收到警告在第二行。

这没关系

<div class="panel panel-primary">
        <div class="panel-heading panel-head">Factors selection<a href="#" data-placement="left" data-toggle="popover" title="Info" 
             data-content='Select desired pair of factors. 
             Selection goes in this direction: XGroup YGroup, XFactor, YFactor' style="float:right" data-trigger="hover"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span></a></div>
        <div class="panel-body">

这没关系

<div class="panel panel-primary">
        <div class="panel-heading panel-head">Factors selection<a href="#" data-placement="left" data-toggle="popover" title="Info" 
             data-content='Select desired pair of factors.-> 
             Selection goes in this direction: XGroup YGroup, XFactor, YFactor' style="float:right" data-trigger="hover"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span></a></div>
        <div class="panel-body">   

警告,引号标记不匹配

<div class="panel panel-primary">
        <div class="panel-heading panel-head">Factors selection<a href="#" data-placement="left" data-toggle="popover" title="Info" 
             data-content='Select desired pair of factors. 
             ->Selection goes in this direction: XGroup YGroup, XFactor, YFactor' style="float:right" data-trigger="hover"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span></a></div>
        <div class="panel-body">

1 个答案:

答案 0 :(得分:0)

&#39; - &gt;&#39;导致错误,因为它本身通常意味着评论结束为&#39;&lt;! - &#39;意味着评论的开始。因为它出现在一个新行上,html将其视为评论而不是上述文本的延续。 为了达到最佳实践,我建议使用&amp;#10 \;和&amp;#13 \; (忽略\),如

'Select desired pair of factors.&#10;&#13;->Selection goes in this direction: XGroup YGroup, XFactor, YFactor'

它阅读起来更容易,下一个程序员将​​比仅仅公开的空白更清楚地理解你的意图。