简体   繁体   English

CSS类属性动态变化

[英]css class attribute changing in dynamically

I have a codeignter based site.In that i loaded the css file like this: 我有一个基于codeignter的site.In,我这样加载css文件:

<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? 然后我想检查forgot_password这个类在css文件中是否存在。如果存在,那么我想更改this( forgot_password )类的color属性。我可以使用php吗?

How can i change the attribute?Is this possible by any way? 我该如何更改属性?

You can change it with the help of the Javascript and there is the possible duplicate of your question please click here 您可以在Javascript的帮助下进行更改,并且您的问题可能重复存在,请点击此处

Hope this helps 希望这可以帮助

您是否可以向元素动态添加第二种样式来覆盖颜色?

.forgot_password_alt {color:#f00 !important;}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM