Click here to Skip to main content
15,884,177 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When trying to center xml code with css i run into an error, here is my XML Doc:
XML
<?xml-stylesheet href="center.css"?>
<xml>
<center>This is centered</center>
</xml>

This is my CSS file (center.css) :
CSS
center {
	text-align:center;
}


All other css works, meaning if i wanted to i could say color:blue;, but text-align doesnt seem to want to work.
Posted

1 solution

By default your XML elements are converted to inline (span) elements for display. Some of the CSS attributes can not be set on inline elements, and one of them is alignment...
Change your CSS like this:
CSS
center {
  display: block;
  text-align: center;
}
 
Share this answer
 
Comments
G4mm4R4y 20-May-14 17:56pm    
This worked, thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900