Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

addclass with .passage? (Sugarcube 1.0.34)

I am trying to make it so that some passages will have a border around them and others will not. I have tried to use <<addclass>> to add a border to certain passages, but since the border css is held in ".passage .content" I'm unsure how to use it. If it were "body.content" for example it would be <<addclass "body" "content">> but that doesn't work with ".passage" it just gives the error "no element matched the selector ".passage""

I also tried using <<addtag>> instead to the passages I want to have a border, using [data-tags~=tag] but when I use <<toggletag>> on the passages I don't want to have the border, all of the text is removed as well and only a solid black background is shown.

My stylesheet for the border looks like this:
.passage .content{
box-sizing: border-box;
-moz-box-sizing: border-box;
top: 500px;
width:100%;
vertical-align: center;
border: #fff double 0.4em;
border-radius: 1em;
padding: 1em;
}

Should I be using something else instead of addclass or addtag, or am I just using them incorrectly? I am very new to this. Thanks :)

Comments

  • You shouldn't be using <<addtag>>, period. And, in this case, you probably shouldn't be trying to use <<addclass>> either.

    All you should need to do is to tag the passages—in the passage editor—where you want your border to show up with an appropriately descriptive tag (e.g. bordered). Then use a selector something like the following:
    .bordered .passage .body {
    	border: #fff double 0.4em;
    	border-radius: 1em;
    	padding: 1em;
    }
    

    PS: Put vendor prefixed properties before the standard ones. In other words:
    -vendor-property: value;
    property: value;
    
  • Thank you so much! I didn't know that +Tag in the passage actually did anything useful.
  • gr8y wrote: »
    I didn't know that +Tag in the passage actually did anything useful.
    The default usefulness depends on which Story Format you choose to use.
Sign In or Register to comment.