Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: Antechinus on August 22, 2021, 04:48:41 PM

Title: Divide stickies from other topics.
Post by: Antechinus on August 22, 2021, 04:48:41 PM
I'm messing around with CSS again, running Stylus live on this site. Decided I'd like the sticky topics split off from the other topics a bit, so came up with this idea.

/* ------------------------------------------------ */
/* Seperate sticky & other topics on message index. */
#messageindex .windowbg.sticky + .windowbg:not(.sticky) {
    position: relative;
    margin-top: 11px;
    overflow: visible;
}
#messageindex .windowbg.sticky + .windowbg:not(.sticky)::before {
    display: block;
    position: absolute;
    top: -8px;
    right: 0;
    left: 0;
    height: 3px;
    background: #96a2bb;
    content: '';
}
/* ------------------------------------------------ */

sticky_divider_21_RC4.jpg
Title: Re: Divide stickies from other topics.
Post by: Mick. on August 22, 2021, 05:46:43 PM
Dang bruh, I never sticky anything bahaha! I really dont see the diff.  :-\
Title: Re: Divide stickies from other topics.
Post by: Antechinus on August 22, 2021, 05:56:40 PM
Well if you never sticky anything it won't be any use to you. :D Lots of stickies on this site, though.

And the diff is obviously the gap and the horizontal divider between stickies and other posts.
Similar idea to this one: Make new posts stand out in threads (https://www.simplemachines.org/community/index.php?topic=574760.0).
Although that other idea is for 2.0.x and doesn't work in 2.1 (someone changed the markup of the #new link and it borks that idea).
Title: Re: Divide stickies from other topics.
Post by: vbgamer45 on August 22, 2021, 06:14:03 PM
I like the gap with the hr tag.
Title: Re: Divide stickies from other topics.
Post by: Antechinus on August 22, 2021, 06:17:23 PM
It's not an hr tag. It's all CSS on standard 2.1 RC4 markup, using a ::before pseudo element. :)
Title: Re: Divide stickies from other topics.
Post by: vbgamer45 on August 22, 2021, 07:43:32 PM
Even better.
Title: Re: Divide stickies from other topics.
Post by: Mick. on August 22, 2021, 08:02:32 PM
Ha! I see it now lol......  Ooooooo I could put a dingbat in the center of the divider. Some sweet pin stripes hehehe and dress it up a bit.   8)  Cool beans man.
Title: Re: Divide stickies from other topics.
Post by: Mike66 on August 22, 2021, 08:10:13 PM
I like it when you 'mess around with CSS', you come up with some interesting stuff Antechinus  8)
Title: Re: Divide stickies from other topics.
Post by: Shades. on August 22, 2021, 09:32:24 PM
I like it! 8)
Title: Re: Divide stickies from other topics.
Post by: Antechinus on August 22, 2021, 09:37:23 PM
Quote from: Mick. on August 22, 2021, 08:02:32 PMHa! I see it now lol......  Ooooooo I could put a dingbat in the center of the divider.
You are a dingbat. :D
Title: Re: Divide stickies from other topics.
Post by: Mick. on August 22, 2021, 10:48:22 PM
Quote from: Antechinus on August 22, 2021, 09:37:23 PM
Quote from: Mick. on August 22, 2021, 08:02:32 PMHa! I see it now lol......  Ooooooo I could put a dingbat in the center of the divider.
You are a dingbat. :D
;D  ;D
Title: Re: Divide stickies from other topics.
Post by: Antechinus on August 23, 2021, 01:36:14 PM
Code needs a slight tweak. The code in the OP is triggered if there is a sticky topic in the unread list. To fix that, use this (it just adds #message_index to the start of each declaration).

/* ------------------------------------------------ */
/* Seperate sticky & other topics on message index. */
#messageindex .windowbg.sticky + .windowbg:not(.sticky) {
    position: relative;
    margin-top: 11px;
    overflow: visible;
}
#messageindex .windowbg.sticky + .windowbg:not(.sticky)::before {
    display: block;
    position: absolute;
    top: -8px;
    right: 0;
    left: 0;
    height: 3px;
    background: #96a2bb;
    content: '';
}
/* ------------------------------------------------ */
Title: Re: Divide stickies from other topics.
Post by: Steve on August 23, 2021, 02:02:17 PM
Do you want the code in the OP changed to the one above?
Title: Re: Divide stickies from other topics.
Post by: Antechinus on August 23, 2021, 02:11:30 PM
Sure, if you like.
Title: Re: Divide stickies from other topics.
Post by: Steve on August 23, 2021, 02:20:28 PM
Done.
Title: Re: Divide stickies from other topics.
Post by: Antechinus on August 23, 2021, 02:24:00 PM
Come to think of it, you can lose the three examples of important now that the #messageindex id is in the declarations. The added specificity of that makes the !important redundant. I've edited the code in reply #11.
Title: Re: Divide stickies from other topics.
Post by: Steve on August 23, 2021, 03:45:06 PM
Done.
Title: Re: Divide stickies from other topics.
Post by: Antechinus on August 23, 2021, 03:47:07 PM
Y'know I think it would look prettier with sparkles and dancing unicorns.
I've edited the code in reply #11 again.

 :P  :P  :P  :P  :P  :P  ;D  ;D  ;D
Title: Re: Divide stickies from other topics.
Post by: Steve on August 23, 2021, 04:42:09 PM
Smarta** ... :P
Title: Re: Divide stickies from other topics.
Post by: landyvlad on September 10, 2021, 06:30:23 AM
I haven't edited the code in reply number 11.

I seem to be in a minority  :laugh: