最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - CSS on SAPUI5 Controls - Stack Overflow

programmeradmin1浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论