I’m not sure I understand what you’re asking. You can (and should) remove the inline styles from the <a> tag and place them in an external style sheet.
Are you using some kind of WYSIWYG editor which is creating these inline styles? I’m bemused as to why you’re still using them when they’re clearly causing you problems, and it’s been explained to you multiple times that it’s bad practice.
In your first post, you had an < a> tag, with inline styles. You said you were trying to style it with CSS, and I told you how to do that. Now you’ve removed that tag.
I don’t understand what you mean by “the a style is part of onclick”. You can’t style an element that doesn’t exist. What exactly are you trying to do? Create and style a link which, when clicked, will display the hidden content in #myObj?
This is useful because I can open this page in my browser and see what it is supposed to look like.
Next, the question of the day is “How do I remove the inline styles from the anchor tag” - at least that’s what it sounded like to me.
The next step is to cut and paste the inline styles from the anchor into the head of the page between <style> tags; then add the a selector and curly braces around the CSS styles.
Open the new page in the browser and it should look exactly like the first version.
This example explains once again how to remove inline styles from elements and into CSS styles in the head of the page or into a local stylesheet. The pattern is always the same.
Now the big question remaining for you to answer is WHY do you want to so this? especially since you seem to be dedicated to inline styles and deprecated HTML code?
Originally, you said you wanted to style the <a> element using CSS. I gave you instructions for doing this, and @ronpat has since posted a step-by-step tutorial. However, you did not leave the <a> tag in situ and move the styling to the CSS, as per your original question. For some reason, you replaced the <a> tag with an empty <div>. I didn’t suggest that at any point, so I need to understand why you did it.
More importantly, I need to know what it is you want this code to achieve, because at the moment, I don’t understand it, from the excerpt you’ve posted.
I also asked
and again, you ignored that. Please answer it.
If you want help on these forums, then I strongly suggest that you answer questions when other members ask. This is not idle curiosity on our part; it’s a genuine attempt to gather relevant information in order to offer the most constructive assistance we can.
And we would very much like to know the question, so it seems we are at an impasse.
Your original question, regarding moving the styles away from the <a> tag and into the CSS, has now been answered several times. In the absence of any information about the apparent new question, there is nothing we can do to help.