简体   繁体   English

在Eclipse中使用HTML5 CSS

[英]Using HTML5 CSS in Eclipse

I am beginner in SAPUI5. 我是SAPUI5的初学者。 I am building SAPUI5 application with HTML5 in Eclipse. 我正在Eclipse中使用HTML5构建SAPUI5应用程序。 In index.html page I am creating a html5 page, I have created css folder under WebContent. 在index.html页面中,我正在创建html5页面,在WebContent下创建了css文件夹。 In index.html I added to refer css file. 在index.html中,我添加了引用CSS文件的功能。 But properties in css are not affecting in html page. 但是CSS中的属性不会影响html页面。 Do I need to add any other code to refer CSS file. 我是否需要添加任何其他代码来引用CSS文件。

Css: CSS:

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

To use CSS within the SAPUI5 environment you should link your controls to a specific CSS class. 要在SAPUI5环境中使用CSS,您应该将控件链接到特定的CSS类。 You can do it like this: 您可以这样做:

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

And your CSS could look like this: 您的CSS可能如下所示:

@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: 确保将CSS文件加载到应用程序中,例如在html文件中加载以下文件:

<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. 根据您的需要,您还可以查看一下App控件,如果您使用的是移动控件,该控件提供了一些用于背景图像的实用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM