You are here


Posted Mar 26, 2019

I've been working on a website with the requirement to truncate certain text fields—display the first several words of the text, with a "show more" link which on click, expands the rest of the text. As I was under a very tight deadline, I found and implemented a jQuery plugin that did what I needed. Quick and easy. However, that approach creates several problems. One, it's a lot of code for a pretty simple function. Two, since it's applied client-side, not server-side, it didn't work on...

Tags: Drupal 8, twig, html, javascript, content display, theming

read more

Posted Aug 4, 2016

(Note that this technique is totally deprecated by Flexbox and CSS Grid, but it's interesting for historical purposes, I guess). If you've ever tried to do it, you know that vertically centring elements in CSS is notoriously difficult. Horizontal centring is a relative breeze, but vertical is another story. I often have a use-case where I want to vertically centre some text on top of an image, say for a site banner. For example: I have a few requirements: I want the image to be an actual...

Tags: front end, CSS, vertical centering

read more