开发者

How do style arbitrary XML as a list with CSS?

开发者 https://www.devze.com 2023-02-21 18:56 出处:网络
I want this: <?xml version=\"1.0\" encoding=\"UTF-8\"?> <?xml-stylesheet href=\"foo.css\" type=\"text/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

精彩评论

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