2013-01-24 29 views
4

我有一個aui:input在我的表格中,標籤爲First Name *。現在標籤的當前字體顏色是黑色的。我想要的是黑色字體的標籤First Name和紅色的*不同風格的合金UI輸入標籤

有誰知道如何做到這一點?

<aui:input model="<%= User.class %>" 
      name="firstName" 
      label="First Name *" 
      showRequiredLabel="" 
      value="<%=user.getFirstName() %>"> 
</aui:input> 

回答

5

您可以指定這樣的代碼:

<aui:input model="<%= User.class %>" 
     name="firstName" 
     showRequiredLabel="" 
     label="First Name <span style='color: red;'>*</span>" 
     value="<%=user.getFirstName() %>"> 
</aui:input> 

<!-- 
or else you can also include a CSS Class as <span class="required">*</span> 
then you would need to add a style as: 
--> 

<style> 

    .required { 
     color: red; 
    } 

</style> 

或者,你可以這樣做,而不是:

<label class="aui-field-label" for="<portlet:namespace />firstName"> 
    First Name 
    <span style="color: red;">*</span> 
</label> 

<aui:input model="<%= User.class %>" 
     name="firstName" 
     showRequiredLabel="" 
     label="" 
     value="<%=user.getFirstName() %>"> 
</aui:input> 

無論是根據自己的喜好。

+0

方法1可悲地打破了i18n :(。數字2是好的,所以+1 – Nenotlep