<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/