用短横线实现行内列表样式

huangapple go评论61阅读模式
英文:

Inline list-style-type with dash

问题

需要编写带有破折号的内联列表样式。

这个有效:

'<ul><li style="list-style-type: &#39;-&#39;"> text </li></ul>'

但我使用XtraReport,那里不起作用。必须在开头和结尾加上引号&#39;

我编辑了问题。

英文:

I need to write Inline list-style-type with dash.

this works:

&#39;&lt;ul&gt;&lt;li style=&quot;list-style-type: &#39;-&#39; &quot;&gt; text &lt;/li&gt;&lt;/ul&gt;&#39;

But I use XtraReport and there it doesnt. There has to be quotation mark ' at the begining and at the end.

I edited the question.

答案1

得分: 1

Use ' for inside the inline, to avoid confusion to closing style property.

Also, close <li> tag first before closing <ul> tag.

So, instead of:

<ul><li style="list-style-type: "- ";"> text </ul></li>

use:

<ul><li style="list-style-type: '&#39;-&#39;;"> text </li></ul>
英文:

Use ' for inside the inline, to avoid confusion to closing style property.

Also, close &lt;li&gt; tag first before closing &lt;ul&gt; tag.

So, instead of:

&lt;ul&gt;&lt;li style=&quot;list-style-type: &quot;- &quot;;&quot;&gt; text &lt;/ul&gt;&lt;/li&gt;

use:

&lt;ul&gt;&lt;li style=&quot;list-style-type: &#39;- &#39;;&quot;&gt; text &lt;/li&gt;&lt;/ul&gt;

答案2

得分: 0

  • – 项目 1
  • – 项目 2
  • – 项目 3

"添加了样式属性到<ul>元素,通过设置list-style-type: none来去除默认的项目符号,并添加了一些额外的样式来去除任何默认的填充。

每个列表项<li>具有display: inline属性,使它们呈现为内联,并且设置了list-style-type: none属性来去除任何默认的项目符号。

在每个列表项内,使用了"&ndash; HTML实体"来表示破折号字符。"

英文:

<ul style="list-style-type: none; padding: 0;">
<li style="display: inline; list-style-type: none;">
<span>&ndash; Item 1</span><br>
</li>
<li style="display: inline; list-style-type: none;">
<span>&ndash; Item 2</span><br>
</li>
<li style="display: inline; list-style-type: none;">
<span>&ndash; Item 3</span><br>
</li>
</ul>

&quot;&lt;ul style=&quot;list-style-type: none; padding: 0;&quot;&gt;
  &lt;li style=&quot;display: inline; list-style-type: none;&quot;&gt;
    &lt;span&gt;&amp;ndash; Item 1&lt;/span&gt;&lt;br&gt;
  &lt;/li&gt;
  &lt;li style=&quot;display: inline; list-style-type: none;&quot;&gt;
    &lt;span&gt;&amp;ndash; Item 2&lt;/span&gt;&lt;br&gt;
  &lt;/li&gt;
  &lt;li style=&quot;display: inline; list-style-type: none;&quot;&gt;
    &lt;span&gt;&amp;ndash; Item 3&lt;/span&gt;&lt;br&gt;
  &lt;/li&gt;
&lt;/ul&gt;
&quot;

added the style attribute to the <ul> element to remove the default bullet points by setting list-style-type: none and added some additional styling to remove any default padding using padding

Each list item "(<li>)" has the display: inline property to make them appear inline, and the list-style-type: none property is set to remove any default list-style-type.

Inside each list item, the &quot;&amp;ndash; HTML entity&quot; is used to represent the dash character.

答案3

得分: 0

Try this code, it is working.

&lt;html&gt;
&lt;head&gt;
&lt;style&gt;
ul.dash-list {
    list-style-type: none;
  }
ul.dash-list li::before {
    content: &quot;-&quot;
    margin-right: 5px;
  }
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;


&lt;ul class=&quot;dash-list&quot;&gt;
  &lt;li&gt;第一项 &lt;/li&gt;
  &lt;li&gt;第二项&lt;/li&gt;
  &lt;li&gt;第三项&lt;/li&gt;
&lt;/ul&gt;


&lt;/body&gt;
&lt;/html&gt;
英文:

Try this code, it is working.

&lt;html&gt;
&lt;head&gt;
&lt;style&gt;
ul.dash-list {
    list-style-type: none;
  }
ul.dash-list li::before {
    content: &quot;-&quot;;
    margin-right: 5px;
  }
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;


&lt;ul class=&quot;dash-list&quot;&gt;
  &lt;li&gt;First item &lt;/li&gt;
  &lt;li&gt;Second item&lt;/li&gt;
  &lt;li&gt;Third item&lt;/li&gt;
&lt;/ul&gt;


&lt;/body&gt;
&lt;/html&gt;

Thanks

huangapple
  • 本文由 发表于 2023年6月15日 16:17:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76480464.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定