Title: Add CSS on posts only
Last modified: June 17, 2023

---

# Add CSS on posts only

 *  [ahmedalnaqa](https://wordpress.org/support/users/ahmedalnaqa/)
 * (@ahmedalnaqa)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/add-css-on-posts-only/)
 * Dears,
 * I am using the free version, and I want to add a css on the post only.
 * am already find a solution to add this CSS code on a single page in the template“**
   single.php**” file but as we know any update will remove it.
 * the css code
 *     ```wp-block-code
       <div style="position: relative;z-index:-1; top:-250px; background-color:#1B2643; width:100%; height:115px"></div>
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/add-css-on-posts-only/#post-16828718)
 * I’m a little confused – the code you posted is HTML, not CSS. Where exactly are
   you hoping this is placed?
 *  Thread Starter [ahmedalnaqa](https://wordpress.org/support/users/ahmedalnaqa/)
 * (@ahmedalnaqa)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/add-css-on-posts-only/#post-16828903)
 * sorry for that, I need to add this HTML code in the single post page of the template:
 * ![](https://i0.wp.com/i.postimg.cc/vT4nCfcs/ggggg44444.png?ssl=1)
 * Can I add this code in only this page
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/add-css-on-posts-only/#post-17195862)
 * Sure, you can use a function like `is_single()` to control where the code might
   be displayed.
 * Inserting into theme templates really depends on which theme you’re using. Some
   have greater flexibility than others.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Add CSS on posts only’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * Last activity: [2 years, 4 months ago](https://wordpress.org/support/topic/add-css-on-posts-only/#post-17195862)
 * Status: not a support question