I actually work on a plugin for wordpress and I have problem to dynamically stylize a button form (input[type="submit"]), because some wordpress themes use the "!important" property.
I want to override that use JavaScript under HTML input objects, because i want to call some css value using php.
In the demo below I have volentary put the "!important" property in the css style to try to override it.
input[type="submit"] {
font-family: FontAwesome, 'Diplomata SC', "Helvetica Neue", helvetica, arial, sans-serif;
font-weight: bold;
text-transform: uppercase;
display:block;
background-color: #333333!important;
color: #FFFFFF!important;
padding: 5px 11px;
letter-spacing: 2px;
border: none;
cursor: pointer;
font-size: 15x;
border-radius: 3px;
box-shadow: 0 -3px rgba(0, 0, 0, 0.14) inset;
}
input[type="submit"]:hover {
background-color: #27ccc0!important;
color: #FFFFFF!important;
}
<input
onmouseover="this.style.backgroundColor='#6ce033'; this.style.color='#FFF'; return true;"
onmouseout="this.style.backgroundColor='#40c200'; this.style.color='#FFF'; return true;"
type="submit">
<?php
function add_button($id) {
$stored_meta = get_post_meta($id);
$btn_bg_color = esc_attr( $stored_meta['btn_bg_color'][0]);
$btn_txt_color = esc_attr( $stored_meta['btn_txt_color'][0]);
$hover_btn_bg_color = esc_attr( $stored_meta['hover_btn_bg_color'][0]);
$hover_btn_txt_color = esc_attr( $stored_meta['hover_btn_txt_color'][0]);
echo '<input onmouseover="this.style.backgroundColor='."'".$btn_bg_color."'".'; this.style.color='."'".$btn_txt_color."'".'; return true;"
onmouseout="this.style.backgroundColor='."'".$hover_btn_bg_color."'".'; this.style.color='."'".$hover_btn_txt_color."'".'; return true;" type="submit">'
?>
}
Above, a concrete example of what I want to do. Changing the style depending the post id.