Dublin Library

The Publishing project

Working with radial gradients

Radial gradients radiate out from a central point that you control. The first example is a gradient between two colors. The default position for the gradient is 50% 50%, at the center of the containing block. Because we didn't specify dimensions for the color stops, the browser will use its default algorithm to create the gradient. css .demo01 { background: radial-gradient red, blue ; } The second demo shows a three color gradient placed at the default location of 50% 50%. css .demo02 { background: radial-gradient red, green, blue ; } There are two types of radial gradients: circular and...

Continue reading →

The popover API

In addition to dialogues, there is a new API to handle popovers, small blocks of text, natively in the browser. This post will explore the Popover API, what it does, how it works and provide examples of how to use it. Necessary context Before we jump into popovers we need to define a few terms. Top layer : The top layer, as the name implies is painted last as the top-most layer of content in the browser viewport, regardless of document order or z-index values. : By default, if multiple elements are positioned in the same location, the browser paints...

Continue reading →

Dialogues in HTML

The web platform now provides ways to build dialogues without having to use third-party libraries. This post will cover dialogues and modal dialogues, the Javascript necessary to interact with the dialogues we create and some basic CSS. Basic Dialogue The HTML is simple. We first create a div with the content we want the user to see in the dialogue, including the dialogue's close button. If we don't put it inside the dialogue, it'll be impossible to close the modal dialogue via user action. We also add buttons to open the dialogue either as a normal dialogue or a modal...

Continue reading →

What does isolation do in CSS?

The isolationhttps://developer.mozilla.org/en-US/docs/Web/CSS/isolation property provides a way for an element to create a stacking contexthttps://developer.mozilla.org/en-US/docs/Web/CSS/CSSPositioning/Understandingzindex/Thestackingcontext without using any special technique to do so. Creating new stacking orders prevent an element from acquiring blend-modes from elements in the backdrop. The following example demonstrate how isolation works with mix-blend-modehttps://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode See the Pen isolation property test with background image by Carlos Araya @caraya on CodePen. In the example there are two elements with a magenta background. The only difference is the isolation declaration. The first box with class isolation-auto sets isolation to auto, the default value. This let's the background through, blending it with...

Continue reading →

Making my life easier: Color Conversion Tool

> "We will encourage you to develop the three great virtues of a programmer: laziness, impatience, and hubris." — Larry Wall, Programming Perl 1st edition, Oreilly And Associates Taken from: Laziness Impatience Hubrishttps://wiki.c2.com/?LazinessImpatienceHubris. This came in to my mind today as I finished a quick and dirty color conversion tool. All the new color spaces available in the new color level 4https://www.w3.org/TR/css-color-4/ and color level 5https://www.w3.org/TR/css-color-5/ specifications it makes it hard to keep all the different syntaxes in my head. So I wrote a little app that, given a color, will produce a color swatch for the seven syntaxes I'm...

Continue reading →

Individual transform properties

To apply transforms to an element, use the CSS transform Property. The property accepts one or more s which get applied one after the other. css .target { transform: translateX50% rotate30deg scale1.2; } One issue with this is that, if we want to update one of the properties then we have to update all of them. For example, if we want to change scale to 1.5 we need the following: css .target:hover { transform: translateX50% rotate30deg scale2; } This is tedious and error-prone, particularly if you create many of these variations. Chrome 104, Edge 104, Firefox 72 and Safari 14.1...

Continue reading →

Publishing directly from Github to DreamHost

After a while, I finally pulled the plug from Media Temple / Go Daddy and moved to a different host if you want to know why I moved, ping me on social media, won't discuss it in this post. I currently host smaller projects on Netlify and they are a good host but it's another server I have to worry about and I made publishing unnecessarily hard and I don't know how to change it. So I decided to consolidate everything into my domain. This post will document the process, both in the command line and an automated version using...

Continue reading →

Code Defensive CSS

One of the things I've always appreciated learning about writing Javascript is to code defensively. Defensive coding or defensive programming,is the practice of eliminating assumptions in the code, especially when it comes to handling information in and out of other routines. Write Better CSS By Borrowing Ideas From JavaScript Functionshttps://www.smashingmagazine.com/2023/04/write-better-css-borrow-ideas-javascript-functions/ provides ideas and solutions for writing defensive CSS. I'm starting from a different place. How can we reduce code repetition and how can we keep ourselves honest when writing CSS? I will use the CSS Properties and Values Level 1 APIhttps://drafts.css-houdini.org/css-properties-values-api/ Houdini CSS Variables as an example of how we...

Continue reading →

Dynamic imports

Dynamic imports have been around for a while but it wasn't until recently that I started looking at the API since it seems to answer a question I've had for a while: How to lazy load Javascript modules at run time without making things unnecessarily difficult for me as a developer. This post will explore one possible way to answer the question I originally asked. We will also look at the difference between the current, static, way to import modules and dynamic, function-like, imports, and some additional uses for the syntax. The way we've always done it In most scripts...

Continue reading →

CSS Relative Colors and Building Color Palettes

In an Deep Dive Into color-mixhttps://publishing-project.rivendellweb.net/deep-dive-into-color-mix/ I used color-mix to lighten and darken colors. There is another technique to accomplish the same task: relative color syntax. Relative color syntax allows us to manipulate and convert any color to any format. We can use it to create a color palette from any chosen color To make things easier, we'll store both the base color and the relative colors based on it in custom properties. The syntax looks like this: css :root { background: labfrom var--theme-primary 10% a b; } in this example we see the following elements: lab indicates the color...

Continue reading →