Title: Specific CSS attributes for a category?
Last modified: August 18, 2016

---

# Specific CSS attributes for a category?

 *  [pyrofenix](https://wordpress.org/support/users/pyrofenix/)
 * (@pyrofenix)
 * [20 years, 1 month ago](https://wordpress.org/support/topic/specific-css-attributes-for-a-category/)
 * I have Postie installed so that I can send photos from my cellphone directly 
   to my site and it works great. Any entries submitted this way are in their own
   category.
 * What i’m trying to do is have WP automagically center the image on the page. 
   Is there a way to have a certain CSS attribute apply to a particular category
   all the time?
 * Thanks!

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

 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [20 years, 1 month ago](https://wordpress.org/support/topic/specific-css-attributes-for-a-category/#post-365034)
 * In your `<head>`:
 * `<?php if(is_category('Category Name') : ?>
    <style type="text/css"> <!-- this{}.
   that { } #the-other { } //--> </style> <?php endif; ?>
 * More on ‘conditional’ tags:
    [http://codex.wordpress.org/Conditional_Tags](http://codex.wordpress.org/Conditional_Tags)
 *  Thread Starter [pyrofenix](https://wordpress.org/support/users/pyrofenix/)
 * (@pyrofenix)
 * [20 years, 1 month ago](https://wordpress.org/support/topic/specific-css-attributes-for-a-category/#post-365136)
 * THANK YOU!
 *  Thread Starter [pyrofenix](https://wordpress.org/support/users/pyrofenix/)
 * (@pyrofenix)
 * [20 years, 1 month ago](https://wordpress.org/support/topic/specific-css-attributes-for-a-category/#post-365138)
 * Doh. Spoke too soon. I get the following error when I input the code
 * “Parse error: syntax error, unexpected ‘:’ in /home/pyrofen/public_html/words/
   wp-content/themes/new theme/header.php on line 46”
 * I put the code just before the closing head tag in my header.php file.
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [20 years, 1 month ago](https://wordpress.org/support/topic/specific-css-attributes-for-a-category/#post-365230)
 * Grr. I slipped up on the coding, sorry. First line should be:
 * `<?php if(is_category('Category Name')) : ?> `
 * A fricken newbie mistake…
 *  Thread Starter [pyrofenix](https://wordpress.org/support/users/pyrofenix/)
 * (@pyrofenix)
 * [20 years, 1 month ago](https://wordpress.org/support/topic/specific-css-attributes-for-a-category/#post-365370)
 * Thanks, that fixed the error.
 * I’m still having a problem though – i’m an idiot sometimes, sorry.
 * [http://www.pyrofenix.com/words/](http://www.pyrofenix.com/words/)
 * This is the blog in question, the top entry was posted directly from my cell 
   phone (most entries from my phone will be just like this), no text. just the 
   image. I’m trying to have the linked image behave differently from normal links.
   I want it centered with the gray box around it similar to the images on the sidebar.
 * I can’t seem to get it to work though. Any ideas?
 * Thanks again!
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [20 years, 1 month ago](https://wordpress.org/support/topic/specific-css-attributes-for-a-category/#post-365387)
 * This seems like it will work for that:
 * `.entry div {
    text-align: center; }
 * `.entry div img {
    padding: 8px; border: 1px solid #d0d2d2; background-color:#
   e6e6e6; }
 * But note you want this in your stylesheet at all times (assuming this request
   is directly related to the original post) as you need to affect your home, category,
   and single post pages.
 *  Thread Starter [pyrofenix](https://wordpress.org/support/users/pyrofenix/)
 * (@pyrofenix)
 * [20 years, 1 month ago](https://wordpress.org/support/topic/specific-css-attributes-for-a-category/#post-365423)
 * Thank you! I owe you big time!

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

The topic ‘Specific CSS attributes for a category?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 2 participants
 * Last reply from: [pyrofenix](https://wordpress.org/support/users/pyrofenix/)
 * Last activity: [20 years, 1 month ago](https://wordpress.org/support/topic/specific-css-attributes-for-a-category/#post-365423)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
