Step 14: Custom CSS and Theme Colors 自定义CSS类

一、练习

新建文件夹14,复制练习文件夹下内容Step 12: Shell Control as Container && Step 13:Margins and Paddings 使用CSS类对页面美化-

1.1 新建style.css

首先在webapp下新建css文件夹,再在css文件下新建style.css文件

css 复制代码
html .myAppDemoWT .myCustomButton.sapMBtn {
  margin-right: 10px;
  margin-left: 0.125rem;
  color: rgb(18, 92, 239);
}

.myAppDemoWT .myCustomText {
  display: inline-block;
  font-weight: bold;
  color: rgb(18, 92, 239);
}

2.2manifest.json新增配置

"sap.ui5" 新增css配置如下

css 复制代码
 "resources": {
      "css": [
        {
          "uri": "css/style.css"
        }
      ]
    }

2.3 App.view.xml

XML 复制代码
<mvc:View
   controllerName="sap.ui5.walkthrough.controller.App"
	xmlns="sap.m"
	xmlns:mvc="sap.ui.core.mvc" 
   displayBlock="true">
 <Shell>
      <App class="myAppDemoWT">
         <pages>
            <Page title="{i18n>homePageTitle}">
               <content>
                  <Panel
                     headerText="{i18n>panelTitle1}">
                     <content>
                        <Button
                        text="{i18n>ButtonText}"
                        press="onPress"
                        class="myCustomButton"/>
                        <Input 
                        id="input2"
                        value="{/recipient/name}"
                        valueLiveUpdate="true"
                        width="60%"/>
                        <Text
                        text="{i18n>textDesc} {/recipient/name}"                       
                        class="sapUiSmallMargin myCustomText"/>
                     </content>
                  </Panel>
               </content>
            </Page>
         </pages>
      </App>
   </Shell>
</mvc:View>

与Step12相比,

  • App标签新增class="myAppDemoWT"
  • Button类替换class="myCustomButton"
  • Text标签类替换class="sapUiSmallMargin myCustomText"

2.4 运行结果

相关推荐
jktantan5 小时前
Vue keep-alive 切标签后滚动位置回顶?因为 onDeactivated 里读到的 scrollTop 是 0
前端·javascript·vue.js
2601_962885726 小时前
quotes 字段全解:涨跌幅、振幅、换手率的口径与单位
java·前端·spring
excel6 小时前
encodeURI 和 encodeURIComponent 有什么区别?
前端
前端精髓6 小时前
调用openrouter的免费API模型
java·前端·javascript
赛博守夜人6 小时前
AI安全攻防与治理之十四:AI 安全测试不能脱离传统安全,Web、API、移动端与模型攻击面的组合拳
前端·人工智能·安全
开开心心_Every6 小时前
快速隐藏程序工具自定义快捷键一键切换
java·开发语言·前端·spring·智能手机·word·intellij-idea
networknomad7 小时前
OpenReplay:自己搭的会话回放工具,给前端排错用的
前端·其他
缓慢更新8 小时前
AI 辅助生成单测:从接口定义到用例的流水线
java·服务器·前端·网络·数据库·人工智能
陈随易8 小时前
AI 运维服务器,安全又可靠的方法
前端·后端·程序员
风骏时光牛马9 小时前
AI稳定性治理体系构建与疑难问题深度分析
前端