The default Prosilver "user online" indicator suffers from two issues:
- It's not at all accessible. Since it is only a background image it is invisible to screen readers, and there is no other labelling of online status anywhere.
- It requires a different image (and a different folder and a different CSS file) for every language you want to support. This is a nuisance if you don't like making new images and writing new CSS.
To mimic the default Prosilver arrangement (which, in this case, I actually quite like) requires a bit of trickery, but nothing too outrageous.
The markup is just a span (or whatever) like this:
Code: Select all
<div id="p{postrow.POST_ID}" class="post has-profile <!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_POST_DELETED --> deleted<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_POST_HIDDEN --> online<!-- ENDIF --><!-- IF postrow.POSTER_WARNINGS --> warned<!-- ENDIF -->">
<!-- IF postrow.S_ONLINE and not postrow.S_POST_HIDDEN --><span class="user_online">{L_ONLINE}</span><!-- ENDIF -->
<div class="inner">
The CSS for the Prosilver look goes like this (change colours to suit the style):
Code: Select all
/* ------------------ */
/* Online indicator. */
/* ------------------ */
.user_online {
pointer-events: none;
position: absolute;
/* Online - en */
top: 5.0rem;
left: -1.4rem;
width: 9rem;
/* Conectado - es *//*
top: 6.4rem;
width: 11rem;
/* ---------- */
background: #fff7;
font-size: 1.3rem;
line-height: 1.7rem;
text-align: center;
text-transform: uppercase;
border: solid #0007;
border-width: .1rem 0;
clip-path: polygon(1.9rem 0, calc(100% - 1.9rem) 0, 100% 100%, 0 100%);
transform: rotate(-45deg);
transform-origin: top left;
}
The font as shown in both images is Roboto. Obviously you can apply any font styling you like: uppercase, small caps, italic, whatever.
ETA: Just found out the following is incorrect. The clipping actually works off border-box by default, so you can use a normal top and bottom border. I've edited the suggested code above to do it that way, which is less hassle. It still looks the same. All you need to do is make sure the top measurements for the polygon clip path take into account line-height plus the widths of any borders.
In this case line-height = 1.7 rem, borders = 2 x .1rem, so total = 1.9rem.
Do note that because this trick relies on clip-path to create the polygon you cannot use a top and bottom border. If you want to emulate those, one easy way is to use inset box-shadow with zero blur radius. Another way would be to use a linear-gradient, like this...