# Is there a way to assign a class directly to a stack?

**URL:** <https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013>\
**Category:** RapidWeaver Classic\
**Created:** [March 24, 2016, 5:25pm UTC](https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013 "2016-03-24T17:25:06Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![TeamSDA](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/teamsda/32/1852_2.png) [@TeamSDA](https://forums.realmacsoftware.com/u/TeamSDA)\
**Post date:** [March 24, 2016, 5:25pm UTC](https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013/1 "2016-03-24T17:25:07Z")

</div>

**Hello Community…** Is there a way to assign a class directly to a stack? Have tried the [CSS Box](https://joeworkman.net/rapidweaver/stacks/css-box/) stack, which does work but it adds another div and requires using a descendent selector to the class in order to target the actual nested element I am trying to style. The goal is to add a class to several elements so I can simply style them all the same.

Kind Regards,  
Dave

---

<div class="post-metadata">

**Author:** ![robbeattie](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/robbeattie/32/78_2.png) [@robbeattie](https://forums.realmacsoftware.com/u/robbeattie)\
**Post date:** [March 24, 2016, 7:07pm UTC](https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013/2 "2016-03-24T19:07:33Z")

</div>

It’s a bit out of my comfort zone but is this - [https://www.doobox.co.uk/stacks\_store/demos/solo.html](https://www.doobox.co.uk/stacks_store/demos/solo.html) - any good?

---

<div class="post-metadata">

**Author:** ![barz-stacks](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/barz-stacks/32/3644_2.png) [@barz-stacks](https://forums.realmacsoftware.com/u/barz-stacks)\
**Post date:** [March 24, 2016, 7:12pm UTC](https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013/3 "2016-03-24T19:12:01Z")

</div>

My Styler Stack has this ability also (among others):  
[https://rapidweavercommunity.com/rapidweaver/addons/stacks/styler-box](https://rapidweavercommunity.com/rapidweaver/addons/stacks/styler-box)

---

<div class="post-metadata">

**Author:** ![TeamSDA](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/teamsda/32/1852_2.png) [@TeamSDA](https://forums.realmacsoftware.com/u/TeamSDA)\
**Post date:** [March 24, 2016, 7:58pm UTC](https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013/4 "2016-03-24T19:58:53Z")

</div>

**Thank You Both…** Those are great suggestions and something I will most certainly keep in mind. Looks like they will apply the class to the div created by the stack not apply a class to a stack placed inside of it. I may just target a parent ID and use a descendent selector, was just hoping for a way to assign classes to existing stacks.

Please let me know if I am missing something here though.

Kind Regards,  
Dave

---

<div class="post-metadata">

**Author:** ![peterdanckwerts](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/peterdanckwerts/32/22443_2.png) [@peterdanckwerts](https://forums.realmacsoftware.com/u/peterdanckwerts)\
**Post date:** [March 24, 2016, 10:28pm UTC](https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013/5 "2016-03-24T22:28:12Z")

</div>

You can place any stack inside an html enclosure stack (I think there are several around) which will allow you to give any stack a class or an ID.

---

<div class="post-metadata">

**Author:** ![TeamSDA](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/teamsda/32/1852_2.png) [@TeamSDA](https://forums.realmacsoftware.com/u/TeamSDA)\
**Post date:** [March 24, 2016, 10:44pm UTC](https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013/6 "2016-03-24T22:44:10Z")

</div>

**Hi Peter…** Thank you for your input. Do you mean stacks like those suggested earlier and in my original Post? If so those apply the class to an outer div not the div for the stack being placed inside it. Perhaps I have something misconfigured or are you thinking of another stack all together?

Regards,  
Dave

---

<div class="post-metadata">

**Author:** ![peterdanckwerts](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/peterdanckwerts/32/22443_2.png) [@peterdanckwerts](https://forums.realmacsoftware.com/u/peterdanckwerts)\
**Post date:** [March 25, 2016, 2:16pm UTC](https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013/7 "2016-03-25T14:16:13Z")

</div>

I don’t know the stacks mentioned above. I was thinking of Joe Workman’s HTML Enclosure stack. Nothing will change the ID or class (I don’t know what you’re trying to do so I don’t know which you need) of the stack enclosed within it, but why would that matter? If you target the div, you target everything within the div, including the contents of other divs.

---

<div class="post-metadata">

**Author:** ![TeamSDA](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/teamsda/32/1852_2.png) [@TeamSDA](https://forums.realmacsoftware.com/u/TeamSDA)\
**Post date:** [March 25, 2016, 3:00pm UTC](https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013/8 "2016-03-25T15:00:29Z")

</div>

**Hi Peter…** Great question and I value your input. I am using foundation and using the Target stack to position a group of buttons which are used as tabs that stick to the bottom of the page of my practice site. In my test I have applied some basic styling to achieve the desired result, pretty simple stuff and everything works fine but was just wanting to apply a class to each button e.g. something like “buttonMod” instead of grabbing each buttons ID then applying the style to the group of ID’s as I have.

If this is not currently possible in RapidWeaver 6 with Stacks 3 I understand just thought I would reach out to more experienced RapidWeaver users as other tools I have used allows for this sort of thing and want to be sure I am not missing something simple. Below is the css and a screenshot of the published page.

Kind Regards,  
Dave

```
#stacks_out_70649_page0, #stacks_out_70638_page0, #stacks_out_70500_page0 {
float: right;
margin-right: 10px;
box-shadow: 0px 0px 12px 0px rgba(131, 145, 155, 0.75);
-webkit-box-shadow: 0px 0px 12px 0px rgba(131, 145, 155, 0.75);
-moz-box-shadow: 0px 0px 12px 0px rgba(131, 145, 155, 0.75);
}

```

 ![](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/2X/1/17f51407cbdb18144b85a70002536c3680258361.jpg)

---

<div class="post-metadata">

**Author:** ![peterdanckwerts](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/peterdanckwerts/32/22443_2.png) [@peterdanckwerts](https://forums.realmacsoftware.com/u/peterdanckwerts)\
**Post date:** [March 25, 2016, 4:16pm UTC](https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013/9 "2016-03-25T16:16:34Z")

</div>

If all you want to do is apply css to button, you can use Big White Duck’s Button Plus which allows a custom class to be applied. Having said that, I’ve just tried this and HTML Enclose and neither seems to do the job.Bit puzzled by that.

---

<div class="post-metadata">

**Author:** ![Bioguy](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/bioguy/32/109_2.png) [@Bioguy](https://forums.realmacsoftware.com/u/Bioguy)\
**Post date:** [March 25, 2016, 4:19pm UTC](https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013/10 "2016-03-25T16:19:51Z")

</div>

I use @willwood’s [Useful Stack](https://stacks4stacks.com/usefulstack/) for this. But, I don’t know if it adds another div or not, so it may not be an improvement over the one you are using.

---

<div class="post-metadata">

**Author:** ![instacks](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/instacks/32/23339_2.png) [@instacks](https://forums.realmacsoftware.com/u/instacks)\
**Post date:** [March 25, 2016, 4:24pm UTC](https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013/11 "2016-03-25T16:24:48Z")

</div>

**Every** stack should have a unique class already assigned, like  
`de_futural_blogstack_stack`

Here:  
[http://demo.instacks.com/blogstack/](http://demo.instacks.com/blogstack/)

---

<div class="post-metadata">

**Author:** ![peterdanckwerts](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/peterdanckwerts/32/22443_2.png) [@peterdanckwerts](https://forums.realmacsoftware.com/u/peterdanckwerts)\
**Post date:** [March 25, 2016, 4:28pm UTC](https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013/12 "2016-03-25T16:28:11Z")

</div>

This might have some relevance: [http://foundation.zurb.com/forum/posts/2087-border-none-prevents-me-from-styling-my-buttons-with-scss](http://foundation.zurb.com/forum/posts/2087-border-none-prevents-me-from-styling-my-buttons-with-scss)

---

<div class="post-metadata">

**Author:** ![theMountainMoves](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/themountainmoves/32/3836_2.png) [@theMountainMoves](https://forums.realmacsoftware.com/u/theMountainMoves)\
**Post date:** [March 25, 2016, 5:18pm UTC](https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013/13 "2016-03-25T17:18:08Z")

</div>

Under Inspector \> HTML \> JavaScript:

```
$(document).ready(function() {
	$('#stacks_out_70500_page0, #stacks_out_70638_page0, #stacks_out_70649_page0').addClass('buttonMod');
});

```

…And then simply apply the ‘buttonMod’ class onto the CSS panel. See if that works.

**EDIT:**  
I overlooked the fact that you did not wish to input each ID onto the CSS. In this case, judging by the sample image you have provided, you would need to identify each element containing those buttons, followed by designating a classname for that element:

```
$(document).ready(function() {
	$('div[id^="stacks_out"].stacks_out:not(.target-stack)').has('.button').addClass('buttonMod');	
});

```

This snippet will apply the class ‘buttonMod’ to any div with IDs starting with ‘stacks\_out’, provided that they contain the button element. The classname ‘stacks\_out (not containing “.target-stack”)’ narrows the element search down further.

---

<div class="post-metadata">

**Author:** ![willwood](https://avatars.discourse-cdn.com/v4/letter/w/bc8723/32.png) [@willwood](https://forums.realmacsoftware.com/u/willwood)\
**Post date:** [March 25, 2016, 5:28pm UTC](https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013/14 "2016-03-25T17:28:39Z")

</div>

> [@Bioguy](#):
>
> I use @willwood’s Useful Stack for this. But, I don’t know if it adds another div or not, so it may not be an improvement over the one you are using.

Yes it does add a new container to the page. I can’t think of any stacks that wouldn’t add a new container to the page. Although API 7 (for Stacks 3) gave developers the ability to inline stacks (without a parent wrapper) this is intended for use with sub-stacks: [/plist/ · Stacks API](http://yourhead.github.io/StacksAPI/plist/)

Depending on @TeamSDA’s requirements, there are some rather weird and wonderful selectors available in [jQuery](https://jquery.com/) that can be used to look for things in a page. For example you could look for embedded images that have a specific file name. With jQuery, you can identify elements in a page and apply class names (or other attributes) to the parent wrapper dynamically.

---

<div class="post-metadata">

**Author:** ![TeamSDA](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/teamsda/32/1852_2.png) [@TeamSDA](https://forums.realmacsoftware.com/u/TeamSDA)\
**Post date:** [March 25, 2016, 7:07pm UTC](https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013/15 "2016-03-25T19:07:12Z")

</div>

**Thank You All…** Love this type of discussion. Was hoping for a method that would apply my class to a stack inside RapidWeaver prior to publishing. Sounds like this is not possible at the present so it looks like I will need to go with one of three methods.

**Method 1:** Apply styles to a preexisting class where it is OK to affect everything using that class. In my example this would not work as there are other buttons on the page which use the same hard coded class.

**Method 2:** Apply styles via the ID directly as demonstrated in my above post.

**Method 3:** Place all the button stacks in a stack like those mentioned above, in my case I used CSS Box, give it a class name then target only the top level div’s. This technique seems to allow for removing and adding new elements inside the Stacks workflow without having to update ID’s manually but it does add another div container. I provided a screenshot of my steps and the css below.

Regards,  
Dave

```
  .buttonMod > div {
    float: right;
    margin-right: 10px;
    box-shadow: 0px 0px 12px 0px rgba(131, 145, 155, 0.75);
    -webkit-box-shadow: 0px 0px 12px 0px rgba(131, 145, 155, 0.75);
    -moz-box-shadow: 0px 0px 12px 0px rgba(131, 145, 155, 0.75);
    }

```

 ![](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/2X/7/7a882c0bf93aec66a5dc190516c0492f14c6e3b6.jpg)

---

<div class="post-metadata">

**Author:** ![dan](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/dan/32/28516_2.png) [@dan](https://forums.realmacsoftware.com/u/dan)\
**Post date:** [August 12, 2026, 9:18pm UTC](https://forums.realmacsoftware.com/t/is-there-a-way-to-assign-a-class-directly-to-a-stack/6013/16 "2026-08-12T21:18:27Z")

</div>


