Reputation: 125
I'm styling an xml schema into a table, each of the names are a start of a column so they are in one row. I am unable to style the specific id selectors. Is #c1 not the correct syntax to style each specific column element id?
heres the xml
<titles>
<column id="c1">Symbol</column>
<column id="c2">Name</column>
<column id="c3">Last Sale</column>
<column id="c4">Net Change</column>
<column id="c5">% Change</column>
<column id="c6">Volume</column>
</titles>
Heres the css (color:green was just to jest to see if it would style it correctly.)
column{
display:table-cell;
text-decoration:underline;
font-weight:bold;
margin-left:auto;
margin-right:auto;
}
column #c1{
color:green;
}
Upvotes: 0
Views: 1210
Reputation: 545
You can't have numbers in CSS selectors.
You can use the CSS selector :nth-child(n)
to style your elements.
See this JSFiddle: http://jsfiddle.net/u5dpdggd/
column {
display:table-cell;
text-decoration:underline;
font-weight:bold;
margin-left:auto;
margin-right:auto;
}
column:nth-child(1) {
color:green;
}
column:nth-child(2) {
color:red;
}
column:nth-child(3) {
color:blue;
}
column:nth-child(4) {
color:orange;
}
Upvotes: 1
Reputation: 56
CSS for XML does not appear to use the same sort of attribute tags as you would expect for HTML. If you need styles for each column, I would convert this to HTML table, or use Javascript to style DOM elements.
Upvotes: 0