I am trying to style a particular section of a blog post using the WordPress editor in HTML mode.

<div style="background: red;">
Special section

The works fine. But when I add background-image property, the whole style attribute gets stripped off when viewed on the blog.

<div style="background:red; background-image:url(https://.....jpg);">
Special section

How can I define and load css style for a specific post without editing in functions.php or adding definitions in Customizer Additional CSS.


You have a mistake in your code, background image should have "",

check this example

background-image: url("paper.gif");


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.