CSS text-align :(右,左等...);在xml文档中不起作用. [英] Css text-align:(Right, left etc...); not working in an xml doc.

查看:177
本文介绍了CSS text-align :(右,左等...);在xml文档中不起作用.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当尝试使用CSS将xml代码居中时,我遇到错误,这是我的XML文档:

When trying to center xml code with css i run into an error, here is my XML Doc:

<?xml-stylesheet href="center.css"?>
<xml>
<center>This is centered</center>
</xml>


这是我的CSS文件(center.css):


This is my CSS file (center.css) :

center {
	text-align:center;
}



所有其他css均有效,这意味着如果我想我可以说color:blue ;,但text-align似乎并不想工作.



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

推荐答案

默认情况下,您的XML元素将转换为嵌入式(跨度)元素以进行显示.某些CSS属性不能在内联元素上设置,其中之一是对齐...
像这样更改您的CSS:
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:
center {
  display: block;
  text-align: center;
}


这篇关于CSS text-align :(右,左等...);在xml文档中不起作用.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆