body class CSS
-
Hi!
I learned that the homepage in WordPress has the home class in its body tag, so you can load styles for specific body contents. I wanted to create a specific block that only show on front page, so I added the “my_block_1” class to the block with this custom CSS:
.my_block_1 { display: none; } .home .my_block_1 { display: block; }
Unfortunately that doesn’t work: CSS doesn’t apply only on homepage but on all pages.
Am I doing something wrong?
Thx for your help ??
- The topic ‘body class CSS’ is closed to new replies.