1

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; 
}
6
  • can you post the part of the code where you refer the css file? Apr 16, 2014 at 7:00
  • it would be better if you post some code here.
    – SPEC
    Apr 16, 2014 at 7:03
  • Within Head tag I referred like below <link rel="stylesheet" type="text/css" href="css/styles.css" /> Apr 16, 2014 at 7:45
  • Do you want to use CSS for a SAPUI5 Control or for the whole site? Apr 16, 2014 at 8:09
  • 2
    Your CSS snippet is not complete either
    – Qualiture
    Apr 16, 2014 at 8:12

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.