In a DIV I place some text/html code which get loaded from a database. This text sometimes contains font size definitions (ex: font size=”3″). is there a way to override this font size in this specific DIV using CSS.
I am grateful for any help.
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.
Assuming mark-up similar to the following:
Then you can explicitly instruct CSS to
inheritthefont-sizefrom the parent element:JS Fiddle demo.
Please note, of course, that
fontis deprecated and should, therefore, not be used (as support for the element can stop without notice, and/or implementations change without warning).Incidentally, while
!importantwill force a declaration to override the usual cascade of styles, it’s taking a sledgehammer to crack a nut; and, if it can be avoided (and in this case, it seems, it can be avoided) it should be, since it complicates later debugging of styles, and associated inheritance problems.Further, this is treating the symptom of your problem; the problem you’re really facing is the presence of the
fonttags in your content/database. This should be corrected, by removing the elements, and replacing them with appropriately-styled elements, such asem,spanand so forth…References:
fontelement, at the W3.org.fontelement at the MDN.