How to overright inline CSS
For example, this css added inline
element.style{ width: 500px !important; }
How Can I overright this css?
Note: You can’t change this CSS.
I want to overright this css
Add comment
Answers (1)
Add AnswerIf you want how to overright inline CSS so please review my code.
I have created HTML in an index.html file.
<body> <div class="mydiv" id="mydivid" style="width: 500px!important"> test </div> </body>
And I have add CSS in <style>…</style> tag on index.html file.
#mydivid { background: #ffc107; width: 200px !important; }
I have tried width overnight with !important but it’s not working and the output looks like this:
So I have tried another way.
I have overwritten CSS using jQuery
Now I added code in my <script>…</script> tag on index.html file.
$(window).on("load", function() { $(".mydiv").removeAttr("style"); $(".mydiv").css("width","200px"); });
I have removed inline CSS on window load and added new CSS.
So my CSS now working and the output looks like this:
I hope you found something useful ??