html - 如何在不更改边框颜色的情况下更改 Div 中的文本颜色

标签 html css colors

<div class = "signupsubmit">Continue</div>
<style>
.signupsubmit {
        line-height: 32px;
        position: absolute;
        left: 36px;
        top: 527px;
        font-family: arial;
        font-size: 17px;
        font-weight: 600;
        width: 137px;
        height: 30px;
        border-color: #00297A;
        border-radius: 4px;
        border: 1px;
        border-style: solid;
        background-color: #FFB630;
        text-indent: 30px;
        }
</style>

我正在尝试将文本颜色更改为黑色,但保持边框颜色不变,所以这就是我所做的

 <div class = "signupsubmit">Continue</div>
<style>
.signupsubmit {
        line-height: 32px;
        position: absolute;
        left: 36px;
        top: 527px;
        font-family: arial;
        font-size: 17px;
        font-weight: 600;
        width: 137px;
        height: 30px;
        border-color: #00297A;
        border-radius: 4px;
        border: 1px;
        border-style: solid;
        background-color: #FFB630;
        text-indent: 30px;
        color: white; <!-- NEW LINE OF CODE -->
        }
</style>

我做了 color:white,但它也将边框颜色也更改为白色。我想保持边框颜色为黑色。

最佳答案

对我有用的是使用 shorthand 将边框属性组合成 1 行语法...

.signupsubmit {
    line-height: 32px;
    position: absolute;
    left: 36px;
    top: 527px;
    font-family: arial;
    font-size: 17px;
    font-weight: 600;
    width: 137px;
    height: 30px;
    border: 1px solid #00297A;
    border-radius: 4px;
    background-color: #FFB630;
    text-indent: 30px;
    color: white; <!-- NEW LINE OF CODE -->
}
<div class = "signupsubmit">Continue</div>

关于html - 如何在不更改边框颜色的情况下更改 Div 中的文本颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33194535/

相关文章:

javascript - 视差效果在某些浏览器中不起作用

c++ - 为字符串中的特殊单词着色

css - 如何使 float 元素居中?

javascript - 自动选择当前类 - 导航菜单

r - 具有 Gamma 参数的渐变色标?

ARGB 到 RGBA 数组转换的 JavaScript 优化版本

html - 如何将 CSS 样式添加到 HTML 中的聚焦 anchor

css - 在我的画廊中裁剪图像,但它们堆叠在一起。我如何让它们彼此相邻?

html - 转发响应式电子邮件,同时保留媒体查询

javascript - 检查 JQuery 中的 href 属性是否为空