Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.9k views
in Technique[技术] by (71.8m points)

请教一下怎么做到判断元素的背景颜色是需要的颜色时就改成白色

<div class="news wow fadeInUp animated">
  <p style="margin: 0 25px 0 1px;padding: 0px;background-color: rgb(241, 240, 240);line-height: 21px">11111111111111</p>
  <p style="margin: 0 25px 0 1px;padding: 0px;background-color: rgb(241, 240, 240);line-height: 21px">22222222222222</p>
  <p style="margin: 0 25px 0 1px;padding: 0px;background-color: rgb(241, 240, 240);line-height: 21px">33333333333333</p>
</div>

就是P元素的背景颜色background-color: rgb(241, 240, 240),是这个颜色的时候就自动改成白色也就是rgb(255, 255, 255),如果是其他颜色就不变


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

如果样式内联的话 偷个懒?

p[style*="background-color: rgb(241, 240, 240)"] {
  background-color: #fff !important;
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...