css - Inline Style attribute getting stripped off

admin2025-06-05  2

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
</div>

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
</div>

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

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
</div>

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
</div>

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

Share Improve this question asked Jul 30, 2018 at 13:03 NigelNigel 1611 gold badge1 silver badge5 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

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

check this example

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

W3

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749079531a316183.html

最新回复(0)