简体   繁体   中英

css class attribute changing in dynamically

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?

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

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

.forgot_password_alt {color:#f00 !important;}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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