Php 尝试将提交按钮的样式与其他输入分开

Php 尝试将提交按钮的样式与其他输入分开,php,html,css,cakephp,Php,Html,Css,Cakephp,首先,这可能是一个愚蠢的问题,但我是新手,仍然对CSS有点了解。我正在尝试CakePHP并使用它的表单助手生成表单。事情是这样的: <p><?php echo $this->Form->input('email');?></p> <?php echo $this->Form->submit('contact.gif');?> 产生: <p> <div class="input text">

首先,这可能是一个愚蠢的问题,但我是新手,仍然对CSS有点了解。我正在尝试CakePHP并使用它的表单助手生成表单。事情是这样的:

<p><?php echo $this->Form->input('email');?></p>
<?php echo $this->Form->submit('contact.gif');?>

产生:

<p>
    <div class="input text">
        <label for="CharityEmail">Email</label>
        <input name="data[Charity][email]" 
               type="text" 
               maxlength="255" 
               id="CharityEmail" />
    </div>
</p> 
<div class="submit">
    <input type="image" src="/raisin/img/contact.gif" />
</div>

电子邮件

在我的CSS中,我想给输入框一个255px的宽度,但是如果我这样做,那么提交按钮也会变大。另外,我希望输入框周围有边框,但提交按钮没有边框,这也是一个问题

基本上,我如何设计提交按钮的样式?CakePHP的正确方法是什么?

您可以使用:

input[type=text] {width: 255px;}
或者,如果您必须以IE6为目标,您可以使用:

div.text input {width: 255px;}

这应该行得通。在这里,您可以将类型指定为文本

input[type=text] { width:255px; }

下面是针对CakePHP的一种更好的方法。我将通过向输入文本元素添加
class
属性来实现这一点


CakePHP中没有一种方法可以将CSS类添加到表单元素中吗?@jnpcl当然有,我在下面的回答中提到了它。
<?php echo $this->Form->input('email', array('class' => 'yourButtonClass'));
.yourButtonClass { width: 255px; }