在Eclipse中使用HTML5 CSS [英] Using HTML5 CSS in Eclipse
问题描述
我是SAPUI5的初学者。我在Eclipse中使用HTML5构建SAPUI5应用程序。在index.html页面中,我创建了一个html5页面,我在WebContent下创建了css文件夹。在index.html中我添加了引用css文件。但是css中的属性不会影响html页面。我需要添加任何其他代码来引用CSS文件。
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;
}
推荐答案
环境,你应该将你的控件链接到一个特定的CSS类。你可以这样做:
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");
您的CSS可能如下所示:
And your CSS could look like this:
@CHARSET "ISO-8859-1";
.myButtonStyle {
color:#FFCCDD;
}
确保将CSS文件加载到应用程序中,在您的HTML文件中:
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.
这篇关于在Eclipse中使用HTML5 CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!