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

javascript - Extjs change font size for displayfield - Stack Overflow

programmeradmin4浏览0评论

I've a displayfield, and i would like to increase the font size. I've configured it as follow:

{
  xtype:'displayfield',
  cls:'biggertext',
  fieldLabel:'label',
  style:{
         'font-size':'32px'
        },
  labelStyle:{
                'font-size':'32px'
             }
}

but the size of the font for the label and the value field has not changed.

I've also tried to do it via CSS:

.biggertext
{
    font-size: 32px;
} 

but I've no changes about the font size.

What is wrong?

Thank you all

I've a displayfield, and i would like to increase the font size. I've configured it as follow:

{
  xtype:'displayfield',
  cls:'biggertext',
  fieldLabel:'label',
  style:{
         'font-size':'32px'
        },
  labelStyle:{
                'font-size':'32px'
             }
}

but the size of the font for the label and the value field has not changed.

I've also tried to do it via CSS:

.biggertext
{
    font-size: 32px;
} 

but I've no changes about the font size.

What is wrong?

Thank you all

Share Improve this question edited Apr 1, 2014 at 7:32 Marco asked Apr 1, 2014 at 7:22 MarcoMarco 1,3344 gold badges17 silver badges41 bronze badges 2
  • What is the framework you are working? – Sajitha Rathnayake Commented Apr 1, 2014 at 7:49
  • the framework is Extjs 4.1.1 – Marco Commented Apr 1, 2014 at 8:14
Add a ment  | 

5 Answers 5

Reset to default 5

you should use some other properties for this. e.g labelcls.

Here is a demo

{
        xtype: 'displayfield',
        fieldLabel: 'Home',
        name: 'home_score',
        value: '10',
        labelCls: 'biggertext',
        fieldCls:'biggertext',
    }

Try this.!important will overwrite the parent style

.biggertext
{
    font-size: 32px!important;
}

Or

 style:{
         'font-size':'32px!important'
        },
  labelStyle:{
                'font-size':'32px!important'
             }

label:

labelStyle: "font-size:15px;font-weight:bold;width:60;padding:10px 0px 0px 10px;",

value:

style:"font-size:14px;padding:10px 0px 0 15px",

You've missed the ' on your cls biggertext in the ExtJS code. Also you do your styles like this:

style:{
        'font-size: 32px;'
       },
labelStyle:{
        'font-size:32px;'
      }

Also note that labelStyle used to work only if you are wrapping your label in a container with FormLayout.

It could also be that you need to add !important to your CSS. I once needed it, otherwise it would not be displayed correctly in the browser.

labelStyle: 'font-size:16px'

labelStyle prop is of type string, not object. the existing answers are passing an object to the prop, so that didn't work.

hopefully this helps someone unlucky to be still working with extjs.

发布评论

评论列表(0)

  1. 暂无评论