HTML 单选按钮颜色更改

发布于 2024-09-25 15:13:38 字数 93 浏览 2 评论 0原文

我认为这是一件非常简单的事情,但我不知道如何做......因此我在这里。我编写了一个简单的 HTML 表单,需要更改单选按钮上文本的颜色。有人对如何做到这一点有任何想法吗?

I think this is a pretty simple thing to do, but I don't know how.. thus I'm here. I have written a simple HTML form and need to change the color of the text on a Radio Button. Anyone have any ideas on how this is done?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

樱花细雨 2024-10-02 15:13:38
<input type="radio" id="foo">
<label for="foo"> Blah Blah </label>

现在您通过 CSS 选择标签并将其设置为具有颜色...您可以使用类或关系,例如:

.radioDiv label { color:blue; }
<input type="radio" id="foo">
<label for="foo"> Blah Blah </label>

Now you select the LABEL via CSS and set it to have a color... You can use classes or relationship, for example:

.radioDiv label { color:blue; }
落花随流水 2024-10-02 15:13:38

假设以下 HTML:

<input type="radio" name="group1" value="Milk" /><span>Milk</span>

只需向 span 添加一个类,或者将其包装在使用基本 CSS 的 div 和样式中:

#somediv span
{
   color: red;
}

Assuming the following HTML:

<input type="radio" name="group1" value="Milk" /><span>Milk</span>

Just either add a class to the span, or wrap it in a div and style that using basic CSS:

#somediv span
{
   color: red;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文