简体   繁体   English

如何将我的输入字段设为黑色并将文本设为蓝色

[英]How Do I Make My Input Fields Black and Text to Blue

 <form method="post" action="https://ip/form.php"> First name<br> <input type="text" name="fname" value=""><br> Email Address:<br> <input type="text" name="email" value=""><br> Phone: <br> <input type="text" name="phone" value=""><br><br> <input type="hidden" name="formid" value="1"> <input type="submit" name="Sign up" value="Sign up"> </form>

My input fields are white.我的输入字段是白色的。 So is the text.文字也是如此。 User can't see their inputs.用户看不到他们的输入。 How do I change the input field to black and input text to blue?如何将输入字段更改为黑色并将输入文本更改为蓝色? Also, how do I change the submit button to black.另外,如何将提交按钮更改为黑色。

Many thanks, sorry I don't know this stuff better yet.非常感谢,对不起,我还不太了解这些东西。

try this on <style> tag you can change ( black , white ,blue ) to any other color<style>标签上试试这个,你可以将(黑色、白色、蓝色)更改为任何其他颜色

 <style> .text{ background-color: black; color: white; } body{ color:blue; } </style> <form method="post" action="https://ip/form.php"> First name<br> <input class="text" type="text" name="fname" value=""><br> Email Address:<br> <input class="text" type="text" name="email" value=""><br> Phone: <br> <input class="text" type="text" name="phone" value=""><br><br> <input type="hidden" name="formid" value="1"> <input type="submit" name="Sign up" value="Sign up"> </form>

A code snippet along with the description is always a better option.代码片段和描述总是更好的选择。 Anyway, you can use inline css.无论如何,您可以使用内联 css。

<form>
  First name: <input type="text" name="fname" style="background-color: #000; color: blue;"><br>
  <input type="submit" value="Submit" style="background-color: black;">
</form>

Or else you can also use class or id attribute with tags and you can simply define styles inside tag.或者你也可以使用带有标签的 class 或 id 属性,你可以简单地在标签内定义样式。 Like,喜欢,

<style>
#fname{
   background-color: black;
   /*Other Styles*/
}
#sButton{
    background-color: black;
   /*Other Styles*/
}
</style>
<form action="/action_page.php">
  First name: <input type="text" id=''fname" name="fname"><br>
  <input type="submit" id="sButton" value="Submit">
</form>

Hey, before I answer this question I just want to point out that you really need to lay out your questions a bit better.嘿,在我回答这个问题之前,我只想指出你真的需要更好地提出你的问题。 I got my account practically banned a while ago because a load of jerks "weren't pleased by the layout".不久前我的帐户实际上被禁止了,因为很多混蛋“对布局不满意”。 Just a heads up!只是抬头!

If you want to change the color of your input box add a style="color: [your color];"如果要更改输入框的颜色,请添加style="color: [your color];" to your HTML tag, eg:到您的 HTML 标签,例如:

<input type="text" style="background-color: [your color];">

you can use placeholder="[text]" and你可以使用placeholder="[text]"

::-ms-input-placeholder {color: [your color];}

to change the color of the placeholder (the text in the box before the user begins to type) in your in input在输入中更改占位符(用户开始键入之前框中的文本)的颜色

And if you want to change the text color altogether use color like this:如果您想完全更改文本颜色,请使用如下color

<input type="text" style="color: [your color];">

easy :)简单 :)

PS I only got the privilege to post back today so sorry if the question isn't layed out top quality! PS 我今天才有机会回帖,如果问题没有提出最高质量,我很抱歉!

It is fairly simple to do.做起来相当简单。

input[type=text] {
  background: black;
  color: blue;
}

This will only target the input fields with type set to 'text' .这只会针对type设置为'text'的输入字段。 In the example below, We change the button background color and text color.在下面的示例中,我们更改按钮背景颜色和文本颜色。

 input[type=text] { background: black; color: blue; } input[type=submit] { background: black; color: white; }
 <form method="post" action="https://ip/form.php"> First name<br> <input type="text" name="fname" value=""><br> Email Address:<br> <input type="text" name="email" value=""><br> Phone: <br> <input type="text" name="phone" value=""><br><br> <input type="hidden" name="formid" value="1"> <input type="submit" name="Sign up" value="Sign up"> </form>

Hope this is what you were looking for :)希望这是你要找的:)

You have 0 context in your question, so just going by your tags... (Which are confusing too, by the way. What does styling your website have anything to do with vim?)您的问题中有 0 个上下文,所以只需通过您的标签......(顺便说一句,这也令人困惑。您的网站样式与 vim 有什么关系?)

Use color: black;使用color: black; CSS for text color.用于文本颜色的 CSS。 background-color: blue; changes the background color.改变背景颜色。 Optionally use border: none;可选地使用border: none; to remove borders which may or may not be there by default depending on your browser.删除默认情况下可能存在或不存在的边框,具体取决于您的浏览器。

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

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