开发者

can we display list-style-type with span text automatically?

开发者 https://www.devze.com 2023-03-14 16:41 出处:网络
I have a server control that is rendered as开发者_Python百科 a span. In its text I have placed <br> to display text in multilines.

I have a server control that is rendered as开发者_Python百科 a span. In its text I have placed <br> to display text in multilines.

Next I want to display list-style with these <br>s. It can be square or disk. Please guide me how it can be done.


You could convert it to an unordered list:

HTML

<ul>
  <li>Text</li>
  <li>in</li>
  <li>multiple</li>
  <li>lines.</li>
</ul>

CSS

ul
{
    list-style-type: square;

}

OR use block display spans with a background image:

HTML

<span class="bg_square">
    Text
</span>

<span class="bg_square">
    in
</span>

<span class="bg_square">
    Multiple
</span>

<span class="bg_square">
    Lines
</span>

CSS

span.bg_square
{
    display: block;
    background-image: url(path/to/little_square.gif);
    background-repeat: no-repeat;
    background-position: 0 5px;
    padding-left: 20px;
}

Example here.

0

精彩评论

暂无评论...
验证码 换一张
取 消