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
On Thu Jul 20, 2006 at 08:04:49PM -0700, Jamie Quint wrote:> 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?CSS selector syntax is a language in itself. 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..> > Thanks! > ~Jamie > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On Jul 21, 2006, at 12:04 , Jamie Quint 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: <div class="post" id="post_19"></div> <div class="post" id="post_20"></div> 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 Glaesemann grzm seespotcode net
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. On 21/07/06, Michael Glaesemann <grzm@seespotcode.net> wrote:> > On Jul 21, 2006, at 12:04 , Jamie Quint 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: > > <div class="post" id="post_19"></div> > <div class="post" id="post_20"></div> > > 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 Glaesemann > grzm seespotcode net > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >