Style with attribute class : Attribute « CSS Style « XML






Style with attribute class


File: Data.xml

<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="Style.css"?>
<document>
  <paragraph style="normal">
    text <code>style</code>text<code>normal</code>.
  </paragraph>
  <paragraph style="summary">
    text <code>style</code> text<code>summary</code>.
  </paragraph>
  <paragraph style="code foreground">
    text <code>style</code>test<code>code</code> or <code>foreground</code>.
  </paragraph>
  <paragraph style="code-background">
    text <code>style</code> text<code>code background</code>.
  </paragraph>
</document>

File: Style.css

paragraph[style] {
  font-size:12px;
  color:#0000FF;
  display: block;
}
paragraph[style=summary] {
  font-style:italic;
  font-size: 16px;
}
paragraph[style~=foreground] {
  font-family:courier, serif;
  font-weight:bold;
  background-color:#CCCCCC; 
}
paragraph[style|=code] {
  font-family:courier, serif;
  font-weight:bold;
  background-color:#FFFFFF;
  border-style:solid 2px #000000;
}

 








Related examples in the same category

1.Use attr to get the value of attribute
2.attributes Psuedo class