Zend_Form - 添加 CSS 类 :: 如何在 Zend_Form 中添加 css 类到标签?
如何在 Zend_Form 中添加 css 类到标签?
这是html方式:
<dt><label for="foo" class="label-design">Foo</label></dt>
我如何用Zend_Form写上面的行?
(我知道如何编写标签,但我不知道如何添加 ccss 类。
$model = new Zend_Form_Element_Text('model');
$model->setLabel('Model');
)
谢谢,
How can I add css class to label in Zend_Form?
This is html way:
<dt><label for="foo" class="label-design">Foo</label></dt>
How can I write above row with Zend_Form?
(I know how to write label but i dont know how can i add ccss class.
$model = new Zend_Form_Element_Text('model');
$model->setLabel('Model');
)
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
最简单的方法是将类添加到 dt 元素,而不是标签:
然后只需将 CSS 选择器从 label.label-design 修改为 dt.label-design label
The easiest way is to add class to dt element, not to label:
And then just modify your CSS selector from label.label-design to dt.label-design label
可以将类直接添加到标签中。这是 Matthew Weier O'Phinney 撰写的一篇精彩文章,描述了有关装饰器的所有内容: http:// devzone.zend.com/1240/decorators-with-zend_form/。
为了回答你的问题,我会这样做:
It is possible to add a class directly to the label. Here is an awesome article from Matthew Weier O'Phinney describing all about decorators: http://devzone.zend.com/1240/decorators-with-zend_form/.
To answer your question, I would do it like this:
直接将“label-design”类添加到元素 $model 的标签中:
Directly add the class 'label-design' to the label of your element $model: