【问题标题】:Textarea box not showing correctly in Firefox 3.6Textarea 框在 Firefox 3.6 中未正确显示
【发布时间】:2011-05-12 18:15:10
【问题描述】:

我正在为我的网站使用 bitrepository 的 Ajax PHP 表单,并使用他们的 CSS 样式表对其进行样式设置。请到http://diginnovations.com/dig-v4查看网站。

除 Firefox 3.6 外,所有浏览器(甚至 IE8)都能正确显示。 “评论”一词显示在文本区域之外,它也在错误的位置。我使用“位置:相对;”为了移动文本区域和提交按钮。

这是 PHP 代码:

$acf_form_fields = array('sender_name' => array('name'        => 'Name',
                                          'mandatory'   => 1,
                                          'validation'  => array('basic' => 1),
                                          'type'        => 'input',


                                          'errors'      => array('none' => 'Fill your name')),


                'sender_email' => array('name'        => 'Email',
                                          'mandatory'   => 1, 
                                          'validation'  => array('basic' => 1, 'email' => 1),
                                          'type'        => 'input',


                                          'errors'      => array('none'    => 'Fill an e-mail address', 
                                                                 'invalid' => 'Fill a valid e-mail address')),  

                'sender_telephone' => array('name'   => 'Phone Number',
                                            'mandatory'   => 0,
                                            'type'        => 'input'),


                                'sender_message' => array('name'        => '<div class="textbox">Comment</div>',
                                          'mandatory'   => 1, 
                                          'validation'  => array('basic' => 1, 'min_chars' => 15),
                                          'type'        => 'textarea',
                                          'attributes'  => array('rows'  => 5, 
                                                                 'cols'  => 35),

                                          'errors'      => array('none'      => '<div class="textboxerror">Fill your message</div>',
                                                                 'min_chars' => 'Your message should have at least [min_chars] characters.')));

这是 CSS:

/* Label, Input, Textarea */

#ajax_contact_form div.wrap { position: relative; margin: 0;}
#acf_fields div.wrap label.in_field { position: absolute; top: 0; left: 0; width: 160px; display: block; margin: 11px 5px 5px 6px; padding: 0; color: #777; }
#ajax_contact_form div br {display: none;}

#acf_fields div { padding: 1px 0 1px 0px; }

#acf_fields div input { display: inline; font-size: 17px; }
#acf_fields div textarea { position: relative; left: 300px; bottom: 150px; font-size: 17px; display: inline; }

#acf_fields p.acf_escts { padding: 5px 0; }
#acf_fields label.acf_escts { width: 199px; padding-left: 0px; margin: 2px 17px 5px 0px; text-align: right; float: none; }

/* Input, Textarea, Select */
#acf_fields input, textarea, select { -moz-box-shadow: 0 0 3px #eeeeee; background:-moz-linear-gradient(top, #ffffff, #eeeeee 1px, #ffffff 5px); margin: 5px 5px 5px 0; padding: 2px; height: 30px; width: 269px; }
#acf_fields input, select { float: none; border: 2px solid #999; color: #333; -moz-border-radius: 3px; }
#acf_fields textarea { position: relative; left: 300px; bottom: 150px; width: 269px; height: 130px; border: 2px solid #999; color: #333; -moz-border-radius: 3px; }

.textbox { position: relative; left: 300px; bottom: 150px; display: inline; z-index: 150; }

.textboxerror { position: relative; left: 300px; bottom: 150px; display: inline; z-index: 150; }

显然,如果我将它们移动到 FF 3.6 中正确显示,它会打乱所有其他浏览器的定位。

有什么建议吗?提前致谢。

【问题讨论】:

    标签: php css forms textarea ajaxform


    【解决方案1】:

    您有几个结构性问题。

    1) 你不应该把 div 放在 label 里面 -- label 是内联的,div 是块,使用 span 或其他东西 -- 使用 HTML 验证器,你有几个验证错误。

    2) 与其单独移动textarea.textbox,不如移动div.wrap

    【讨论】:

    • 感谢您的提示! div 是问题所在。
    猜你喜欢
    • 2015-04-20
    • 2014-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-25
    • 2013-07-06
    • 2016-01-15
    • 1970-01-01
    相关资源
    最近更新 更多