I am trying to overwrite a style which is defined in a stylesheet that I can’t change. How to do that?
For example, I have something like this in the stylesheet:
.SomeStyle
{
padding:4px;
}
How can I overwrite this in my ASP.NET page?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could try making an identical style more “important” than the one from the stylesheet:
The
!importantdeclaration will give priority to your style over the one defined in your stylesheet. Keep in mind older browsers ignore it altogether (like IE6), so this may not be a perfect solution for you.You could also take a JavaScript/jQuery approach by manipulating which CSS class is assigned to the element.
A little reading material: