Button Sap UI 5 css打开按钮

Button Sap UI 5 css打开按钮,button,sapui5,Button,Sapui5,我只是想在按钮上实现CSS。但它不起作用 <core:View controllerName="sap.hcm.Address" xmlns="sap.ui.commons" xmlns:core="sap.ui.core" xmlns:html="http://www.w3.org/1999/xhtml"> <html:style> .mySuperRedButton { color: red; } </ht

我只是想在按钮上实现CSS。但它不起作用

<core:View controllerName="sap.hcm.Address" xmlns="sap.ui.commons" xmlns:core="sap.ui.core"  xmlns:html="http://www.w3.org/1999/xhtml">
   <html:style>
      .mySuperRedButton {
         color: red;
      }
   </html:style>
   <Panel>
      <Button class="mySuperRedButton" text="Press Me!"/>
   </Panel>
<core:View>

.mySuperRedButton{
颜色:红色;
}

参考链接:

该按钮由多个HTML/DOM元素组成。一些内部控件元素上也可能应用了样式。这正是你的情况:

.sapMBtnInner {
  color: #333333;
}
覆盖你的CSS。您可以通过以下两种方法克服此问题:!重要(不太可取的方式):

或者通过引用内部类:

.mySuperRedButton .sapMBtnInner {
  color: red;
}
如果您对控件的内部HTML更感兴趣,可以检查DOM或控件呈现器类

顺便说一句:为了更好地重用和更清晰的项目结构,您应该将CSS作为一个单独的文件包含进来

溴 克里斯

.mySuperRedButton .sapMBtnInner {
  color: red;
}