Here is the css:
#content ul {
font-size: 12px;
}
I am trying this:
document.getElementById("content ul").style.fontSize = 8px;
But this is not working for me. Can anybody suggest how to do this?
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.
Two issues:
Style properties are strings, so you need
"8px"rather than8px.getElementByIdgets elements by ID. You’re passing in a compound selector (and you’re missing the#from it). You’ll have to use an ID and then find the children (viagetElementsByTagName), or usequerySelector(for the first matching element) orquerySelectorAll(for all matching elements) instead. (Note that although well-supported in general, some older browsers don’t have those last two; details.)So for instance, here’s how you would change the first matching element’s font size on browsers with
querySelectorsupport:Or all of them
Or on older browsers: