如何样式CodeIgniter表单标签

问题描述:

我想改变表单标签的颜色,我想知道如何去做。如何样式CodeIgniter表单标签

<div class="form-group"> 
<div class="medium-6 columns">  
<?php 
echo form_label('First Name'); 

$data = array(
    'class'=>'form-control', 
    'name'=>'fname', 
    'placeholder'=>'First Name' 
); 

echo form_input($data); 
?> 
</div> 
+0

您可以添加class和id的数组分配给它。 –

+0

我试图这样做,但我得到错误 – thomaSmith

+0

你得到了什么错误? –

在您的形式开放,如果你有一个id="exmaple"在你的CSS文件你试过

#example label { 
    color: #222222; 
} 

可能需要的重要

#example label { 
    color: #222222 !important; 
} 

,看起来像你的混合foundation代码bootstrap code bootstrap col-md-6

http://getbootstrap.com/css/#grid-options

我认为最好的办法是..

<div id="firstname" style="color: orange;"> 
     <?php 
     echo form_label('First Name') ; 
     ?> 
     </div> 
+0

使用css文件认为更好 – user4419336

总是使用form_helper方式

$attributes = array(
     'class' => 'class-name-yours', // external or internal css 
     'style' => 'color: #000;'  // or inline css, this is black color 
); 

echo form_label('First Name', 'firstname', $attributes); //first name is form id