Title: css selector for posts?
Last modified: August 20, 2016

---

# css selector for posts?

 *  [tinmanjim](https://wordpress.org/support/users/tinmanjim/)
 * (@tinmanjim)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/css-selector-for-posts/)
 * I have my main blog page styled the way I want it (for the most part), but when
   I click on a post title or a comment link, the result is that the style no longer
   applies to the post. I can style the comments and durn near everything else on
   the page, but the posts are numbered (i.e. – class=post-23…id=post-23).
    Is there
   a css selector that will target these numbered posts? It seems impractical to
   make a separate selector for each post. What am I missing?

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/css-selector-for-posts/#post-2627306)
 * please post a link to your site to illustrate the problem.
 * possibly add another general class to the post div in the template …
 *  Thread Starter [tinmanjim](https://wordpress.org/support/users/tinmanjim/)
 * (@tinmanjim)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/css-selector-for-posts/#post-2627344)
 * The site is [here](http://mullinsite.com/heyjude/). WordPress 3.3.1, Adventure
   Journal 1.7.2.
    The issue is that I’m hoping WordPress has a css selector that
   can target any post, regardless of number; i.e. – div id=’post-42…class=’post-
   42′. If not, I can edit the template, but am I wrong in assuming that an upgrade
   will wipe out the edits? If I can do the job using only my ancillary css stylesheet,
   i’d rather. As you can see, the landing page posts are styled with a background
   image, but clicking on ‘Comments’ or the post title takes you to a post page 
   where the styling is lost, I believe because of the use of the dashed (post-42)
   selector. The funny thing is that on the landing page all the posts are numbered
   the same way; the only difference I can see is that on the landing page there
   is a comment before each post: “post-##”. Is that something I could use? If so,
   I don’t know how…
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/css-selector-for-posts/#post-2627345)
 * the post div seems to use `post_class()` which gives you a number of css clssses;
 * output example from your link:
 * `<div id="post-45" class="post-45 post type-post status-publish format-standard
   hentry category-uncategorized">`
 * the same from the single post:
    `<div class="post-45 post type-post status-publish
   format-standard hentry category-uncategorized" id="post-45">`
 * the css classes `.post` and/or `.hentry` are output for each of the posts and
   are quite generic and could be used for styling.
 * (ps: I have not looked into details why the formatting is off in single posts–
   this is not really scope of a WordPress forum)
 *  Thread Starter [tinmanjim](https://wordpress.org/support/users/tinmanjim/)
 * (@tinmanjim)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/css-selector-for-posts/#post-2627346)
 * (Palm slaps forehead!)
    That’s way too simple; I was hoping for something complicated
   enough that I could justify spending the next few weeks pounding my forehead 
   on my desk…
 * Thanks!

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

The topic ‘css selector for posts?’ is closed to new replies.

## Tags

 * [css](https://wordpress.org/support/topic-tag/css/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [selector](https://wordpress.org/support/topic-tag/selector/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [tinmanjim](https://wordpress.org/support/users/tinmanjim/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/css-selector-for-posts/#post-2627346)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
