# \[Slightly OT\] CSS with wildcard?

**URL:** <https://www.ruby-forum.com/t/slightly-ot-css-with-wildcard/99229>\
**Category:** Rails\
**Created:** [July 21, 2006, 5:05am UTC](https://www.ruby-forum.com/t/slightly-ot-css-with-wildcard/99229 "2006-07-21T05:05:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamiequint](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/22d042/32.png) [@jamiequint](https://www.ruby-forum.com/u/jamiequint)\
**Post date:** [July 21, 2006, 5:05am UTC](https://www.ruby-forum.com/t/slightly-ot-css-with-wildcard/99229/1 "2006-07-21T05:05:37Z")

</div>

Sorry if this is a simple question, I’m a CSS noob.

I have a rails app that is displaying posts, I am having it generate  
each post with its own div like “post\_19”, “post\_20”, etc.

I could make it so it puts another div around that div (i need the  
individual post div’s for deletion with AJAX) but would rather not.  
Is there some way to use CSS to do something like this…

post\_\* {

…some settings…

}

I know this doesn’t work, I tried it, but is there some way to  
accomplish this functionality?

Thanks!  
~Jamie

---

<div class="post-metadata">

**Author:** ![jamiequint](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/22d042/32.png) [@jamiequint](https://www.ruby-forum.com/u/jamiequint)\
**Post date:** [July 21, 2006, 5:08am UTC](https://www.ruby-forum.com/t/slightly-ot-css-with-wildcard/99229/2 "2006-07-21T05:08:56Z")

</div>

On Thu Jul 20, 2006 at 08:04:49PM -0700, Jamie Q. wrote:

> }
> 
> I know this doesn’t work, I tried it, but is there some way to accomplish this functionality?

CSS selector syntax is a language in itself.  
[http://www.google.com/search?hl=en&q=css+selector+syntax&btnG=Google+Search](http://www.google.com/search?hl=en&q=css+selector+syntax&btnG=Google+Search)

you might be able to smash open the pandora’s box even wider with  
XQuery…

---

<div class="post-metadata">

**Author:** ![jamiequint](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/22d042/32.png) [@jamiequint](https://www.ruby-forum.com/u/jamiequint)\
**Post date:** [July 21, 2006, 6:20am UTC](https://www.ruby-forum.com/t/slightly-ot-css-with-wildcard/99229/3 "2006-07-21T06:20:19Z")

</div>

On Jul 21, 2006, at 12:04 , Jamie Q. wrote:

> I know this doesn’t work, I tried it, but is there some way to  
> accomplish this functionality?

Assuming your post\_\d+ are post ids, what I would do is have a post  
(CSS) class.

HTML is something like:

To style all of the posts, your CSS would look something like:

.post { … }

Note preceding period.

Just a reminder, to select the element with id=“post\_19”, you’d use

#post\_19 { … }

Does this accomplish what you want?

Michael G.  
grzm seespotcode net

---

<div class="post-metadata">

**Author:** ![jamiequint](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/22d042/32.png) [@jamiequint](https://www.ruby-forum.com/u/jamiequint)\
**Post date:** [July 21, 2006, 11:38am UTC](https://www.ruby-forum.com/t/slightly-ot-css-with-wildcard/99229/4 "2006-07-21T11:38:25Z")

</div>

What Michael said. There’s no wildcard for matching part of an id  
name, and, as Michael shows, that’s _exactly_ what classes are for -  
describing a generic kind of element.
