简体   繁体   English

使用div将CSS应用于表单

[英]applying css to a form with div

my form is 我的表格是

<div id="search">
    <form action="http://www.google.com/search" method="get" onSubmit="Gsitesearch(this)">
        <input name="q" type="hidden" />
        <input name="qfront" type="text" style="width: 80px" />
    </form>
</div>

in styles css i have put 在我放的CSS样式中

#search {font: 12px  'Arial', sans-serif; color:#fff; text-align:left}

however the form is still not showing the white colour 但是表格仍然没有显示白色

INPUT elements generally do not inherit color or font styles from the surrounding text by default. 默认情况下, INPUT元素通常不继承周围文本的颜色或字体样式。 For example, in an area with blue text, the color of the INPUT value is still going to be the browser default (usually black). 例如,在带有蓝色文本的区域中, INPUT值的颜色仍将是浏览器的默认值(通常为黑色)。 To override this, you need to target the INPUT specifically. 要覆盖它,您需要专门针对INPUT In your case, try: 对于您的情况,请尝试:

#search input { font: 12px 'Arial', sans-serif; color:#fff; }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM