New wordpress widget doesn't accept external css file - How can I add some inline style?

Hello guys

Wordpress introduced a new widget called ‘‘Custom Html’’. You can add some code there and I want to add my favorite one, that will make the menu of my blog smaller because right now is quite big and I want to reduce its size. So, I thought to do this:


#open-me:target {display:block;}
#open-me:not(:target) {display:none;}


<a href="#open-me">Click to open the div</a>
<div id="open-me">
		<li>Li content here</li>
		<li>Li content here</li>
		<li>Li content here</li>
	</ul><a href="#">close me</a>

Unfortunately right now I can’t do that, since Wordpress doesn’t accept an external css file if you have a free (without hosting) blog.

So I wonder, what can I do? I thought to use inline styles but I can’t think any appropriate way. Any ideas? I want html and css ONLY, no Js, Ajax jquery or whatever. Just pure html/css. Can you help me?

Thank you

I think you’re out of luck for this approach with your limitations.

“not” is a pseudo-class and though I didn’t find any documentation AFAIK pseudo-classes can not be used in inline style attributes.

Correct, and :target is also a pseudo class, so cannot be inlined.

If you cannot use an external css, is it possible for you to add <style> tags to the head to hold your css?

1 Like

Why not just add it as the last entry in your theme’s css file…

Yes I was afraid that. Though, thank you for your answer and especially for your time.

No I can’t; I already tried :frowning:

Unfortunately I can’t do that either. I have a free blog hence all these limitations

Anyway, thank you guys. At least I/you tried. Thanks! :slight_smile:

Can you use the following ?

#open-me:target {display:block;}
#open-me:not(:target) {display:none;}

This has already been suggested.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.