abhhab abhhab - 3 months ago 19
CSS Question

CSS on SAPUI5 Controls

I have a sap.m.Input inside a div tag in HTML view of sapui5. When I apply css to the div, it works fine on all the div elements. However, I want to apply css on a single control inside the div tag. It is not working. The code is :

<div data-sap-ui-type="sap.m.Label" data-text="Sr.No :"></div>
<div data-sap-ui-type="sap.m.Input" id="id_SrNo_Val" data-width ="10%"></div>


The above code does not work if I apply css to the input. It works fine on the label. I am trying to reduce the height of the input. It works on Chrome console with runtime id. However I want to apply css with the given id which it does not accept.
Please help.

Answer

In SAPUI5 we don't know at which point time of CSS is applied to the Controls.

So you've to give "priority to your css class or id" which can be achieved using the property !important

Add your CSS property like following

#id_SrNo_Val {
     height : 10px !important;
     color : blue !important;
}

Use anything you want with !important property.

Comments