开发者

How do style arbitrary XML as a list with CSS?

I want this:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="foo.css" type="text/css"?>
<foo>
  <bar>Item1</bar>
  <bar>Item2</bar>
</foo>

To display in a browser as if foo was ol and bar was li in HTML. Is this possible? This doesn't work:

foo {
 display: block;
}
bar { 
 display: list-item;
 list-item-style: decimal;开发者_如何学C
}

But I know something's working because the items are broken into separate lines by setting the display style to list-item.


It works, you're just not seeing it, methinks.

First, make sure the file is .xml.

Next, I've never heard of a CSS property list-item-style. Change it to:

bar { 
 display: list-item;
 list-style: decimal;
}

... and then add some margin and padding:

foo {
 display: block;
}
bar { 
 display: list-item;
 list-style: square;
 padding-left:20px;
 margin-left:20px;
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜