有没有办法使用css引用xml表中的类?

时间:2022-12-23 22:50:02

Here is the Xml, I was wondering how you would reference the class "down" using css so I can style all similar code sections the same? This is just a clip I have the css correctly referenced at the start of my xml file

这是Xml,我想知道如何使用css引用“down”类,所以我可以将所有类似的代码段设置为相同的样式?这只是我在xml文件开头正确引用css的剪辑

  <stock class="down">
     <symbol>AAPL</symbol>
     <company>Apple Computer, Inc.</company>
     <lastSale>$15.26</lastSale>
     <netChange>-0.17</netChange>
     <pChange>-1.10%</pChange>
     <volume>5.548</volume>
  </stock>

1 个解决方案

#1


0  

Your XML:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="styles.css"?>
<stock class="down">
    <symbol>AAPL</symbol>
    <company>Apple Computer, Inc.</company>
    <lastSale>$15.26</lastSale>
    <netChange>-0.17</netChange>
    <pChange>-1.10%</pChange>
    <volume>5.548</volume>
</stock>

Your styles.css CSS:

你的styles.css CSS:

.down {
    //Your styles here
}

Or:

stock.down {
    //Your styles here
}

Or:

[class~=down] {
    //Your styles here
}

Or:

stock[class~=down] {
    //Your styles here
}

#1


0  

Your XML:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="styles.css"?>
<stock class="down">
    <symbol>AAPL</symbol>
    <company>Apple Computer, Inc.</company>
    <lastSale>$15.26</lastSale>
    <netChange>-0.17</netChange>
    <pChange>-1.10%</pChange>
    <volume>5.548</volume>
</stock>

Your styles.css CSS:

你的styles.css CSS:

.down {
    //Your styles here
}

Or:

stock.down {
    //Your styles here
}

Or:

[class~=down] {
    //Your styles here
}

Or:

stock[class~=down] {
    //Your styles here
}