Dublin Library

The Publishing project

Progressive Enhancement versus Graceful Degradation - We're missing something

This articlehttps://meiert.com/en/blog/april-24-is-js-naked-day/ made me think, again, about one of the eternal battles of the web: Graceful Degradation versus Progressive Enhancement but it also made me think about something new. I'm all for Graceful Degradation myself, but I also feel that both arguments miss the point. The post will, again, review the definitions of Progressive Enhancement and Graceful Degradation and will cover why I think we're all missing the point. Definitions The definitions for these terms haven't changed much over the years but it's important to bring them back to the front to have a context for the following section. Graceful...

Continue reading →

Detecting Javascript Support in CSS

There are times when we may want to style content differently based on whether the browser has enabled Javascript or not. This is different than using Javascript to detect whether a script has run or not, this technique will only change the UI where necessary. The technique The technique is simple: We use the @media at-rule with scripting as the property and one of the two valid values for the media query: enabled and none. When using scripting: enabled, we can use the technique to progressively enhance the UI by adding CSS to elements where appropriate. css @media scripting: enabled...

Continue reading →

Playing with text-shadows

text-shadowhttps://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow allows for interesting effects on text. The property takes two or three values with an optional color as the fourth value offset-x and offset-y Required : These values specify the shadow's distance from the text. : offset-x specifies the horizontal distance; a negative value places the shadow to the left of the text. : offset-y specifies the vertical distance; a negative value places the shadow above the text. : If both values are 0, the shadow is placed directly behind the text, although it may be partly visible due to the effect of blur-radius. blur-radius Optional. : The higher...

Continue reading →

Playing with box-shadows

In developing a card with box-shadowhttps://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow I realized that it's harder than I remembered so I decided to take another look. Box shadow takes two, three or four parameters. If two values are specified, they are interpreted as offset-x horizontal offset and offset-y vertical offset values. : Negative offset-x value places the shadow to the left of the element. Negative offset-y value places the shadow above the element. : If not specified, the value of 0 is used for the missing length. If both offset-x and offset-y are set to 0, the shadow is placed behind the element and may...

Continue reading →

New In Node 22 - Task Runner

Node 22 was recently introducedhttps://nodejs.org/en/blog/announcements/v22-release-announce as the current active version. The thing that caught my attention in the release notes is the built-in task runner. In this post we'll look at the Node task runner available in Node 22, how it works and what are its limitations. You run the Node Task Runner using the --run flag with the name of a script listed in the package.json located in the current directory. For example, to run a build script, use the following command: bash node --run build The task runner, as implemented in the current release of Node 22, has...

Continue reading →

Exploring the picture Element

The picture element was added to the HTML specification as part of the responsive images effort. This post will dive into the picturehttps://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture, sourcehttps://developer.mozilla.org/en-US/docs/Web/HTML/Element/source and imghttps://developer.mozilla.org/en-US/docs/Web/HTML/Element/img elements along with the srcsethttps://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset property and explore how we can use them to create responsive images in different scenarios. At its simplest, picture is a wrapper for images created using the img element. html What we're more likely to see is one or more source child elements. html The source element is similar, but not identical, to what we use in video and audio elements. It uses srcset instead of src to indicate...

Continue reading →

Playing With text-emphasis

Sometimes it's nice to put some sort of emphasis on our text to highlight elements or because we just want it to look different. One way to create these highlights is to use the text-emphasishttps://developer.mozilla.org/en-US/docs/Web/CSS/text-emphasis property. This property will add the chosen character or symbol on top of the text, one instance on top of each character of the text. The text-emphasis property is a shorthand for text-emphasis-stylehttps://developer.mozilla.org/en-US/docs/Web/CSS/text-emphasis-style and text-emphasis-colorhttps://developer.mozilla.org/en-US/docs/Web/CSS/text-emphasis-color. There is also a text-emphasis-positionhttps://developer.mozilla.org/en-US/docs/Web/CSS/text-emphasis-position property that controls the position of the emphasis related to the text. If there is not enough space to place the emphasis characters in their...

Continue reading →

Style Queries

In the previous article, we discussed inline-size container queries. There is another type of container query: style queries. There are some significant differences Unlike inline-size queries, every element is a style query container. You can also use CSS conditional properties AKA: CSS variables as the condition in the style query. We first define the condition in the parent element, in this case article-wrapper. We then define the style query in the .article child element and include the styles we want to highight the featured article. css .article-wrapper { --featured: true; } .article { @container style--featured: true { / Custom CSS...

Continue reading →

Building a Card Component

Container queries introduce an additional and complementary way to create content in addition to what media queries allow. This post will look at container queries and how to use them to build a reusable card component. What are container queries and how do they work With container queries, you can apply styles to an element based on the size of the element's container rather than the viewport like we can with media queries. For example, if a container has less space available in the surrounding context, you can hide certain elements or use smaller fonts. Using container queries Using container...

Continue reading →

Figures As Universal Containers

When I see figures, this is what I think about and what I see the most often, maybe with srcset and sizeshttps://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset attributes to handle responsive images. See the Pen figure and image by Carlos Araya @caraya on CodePen. According to the HTML specificationhttps://html.spec.whatwg.org/multipage/grouping-content.htmlthe-figure-element emphasis mine: > The figure element represents some flow content, optionally with a caption, that is self-contained like a complete sentence and is typically referenced as a single unit from the main flow of the document. > > ... > > The element can thus be used to annotate illustrations, diagrams, photos, code listings, etc. In...

Continue reading →