Using HTML5 CSS in Eclipse

我只是一个虾纸丫 提交于 2019-12-24 08:26:50

问题


I am beginner in SAPUI5. I am building SAPUI5 application with HTML5 in Eclipse. In index.html page I am creating a html5 page, I have created css folder under WebContent. In index.html I added to refer css file. But properties in css are not affecting in html page. Do I need to add any other code to refer CSS file.

Css:

@CHARSET "ISO-8859-1";
body {
background-image: "image/splash-sunrise.jpg";
background-size: 100px 100px; 
background-repeat:no-repeat; 
}

回答1:


To use CSS within the SAPUI5 environment you should link your controls to a specific CSS class. You can do it like this:

var myButton = new sap.m.Button();
myButton.addStyleClass("myButtonStyle");

And your CSS could look like this:

@CHARSET "ISO-8859-1";

.myButtonStyle {
    color:#FFCCDD;
}

Make sure that you load the CSS file into your application, for example like this in your html file:

<link href="css/style.css" type="text/css" rel="stylesheet" />

Of course you can use this for your whole page as well. For your needs you could also take a look at the App control which provides some utilities for background images if you´re using mobile controls.



来源:https://stackoverflow.com/questions/23102200/using-html5-css-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!