javascript - CSS on SAPUI5 Controls - Stack Overflow

I have a sap.m.Input inside a div tag in HTML view of sapui5. When I apply css to the div, it works fin

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.

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.

Share Improve this question edited Apr 8, 2014 at 5:56 abhash asked Apr 7, 2014 at 9:09 abhashabhash 2532 gold badges7 silver badges22 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 2

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.

Update: Avoid !important because it'll bee harder to debug at some point of time. Also in CSS, it's not suggested to use.

You may assign additional class to a control adding class="yourStylingClass" attribute.

You shouldn't use control ids for styling, since SAPUI5 may modify those, add prefixes etc.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745258879a4619117.html

相关推荐

  • javascript - CSS on SAPUI5 Controls - Stack Overflow

    I have a sap.m.Input inside a div tag in HTML view of sapui5. When I apply css to the div, it works fin

    7小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信