css类属性动态变化
我有一个基于 codeignter 的网站。我加载了这样的 css 文件:
<link href="<?php echo base_url();?>style/style.css" rel="stylesheet" type="text/css" />
这是该文件中的内容:
.forgot_password {
color:#FF0000;
font-weight:bold;
margin-left:95px;
margin-top:10px;
display:none;
}
.forgot_message {
display:none;
font-size:13px;
font-weight:bold;
color:#C4ED10;
}
.enter_password_fr {
color: #FFFFFF;
font-size: 20px;
font-weight: bold;
margin-left: 100px;
}
然后我想检查 forgot_password
这个类是否存在于 css 文件中。如果它存在,那么我想更改 this (forgot_password
) 类的颜色属性。我可以使用 php 执行此操作吗?
我怎样才能改变属性?这有可能吗?
I have a codeignter based site.In that i loaded the css file like this:
<link href="<?php echo base_url();?>style/style.css" rel="stylesheet" type="text/css" />
This is the content in that file:
.forgot_password {
color:#FF0000;
font-weight:bold;
margin-left:95px;
margin-top:10px;
display:none;
}
.forgot_message {
display:none;
font-size:13px;
font-weight:bold;
color:#C4ED10;
}
.enter_password_fr {
color: #FFFFFF;
font-size: 20px;
font-weight: bold;
margin-left: 100px;
}
Then i want to check forgot_password
this class exist in the css file.If it exists then i want to chnage the color attribute of the this (forgot_password
) class.Can i do this using php?
How can i change the attribute?Is this possible by any way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在Javascript的帮助下更改它,并且您的问题可能有重复单击此处
希望这有帮助
You can change it with the help of the Javascript and there is the possible duplicate of your question please click here
Hope this helps
您不能动态地将第二种样式添加到将覆盖颜色的元素吗?
Couldn't you dynamically add a second style to the element that would override the color?