Turning off font ligatures in CSS (letter connections deactivation)

Typically, modern web browsers will automatically merge certain letter combinations, such as 'f' and 'i', into a single character known as a ligature. While this can enhance readability, it may not always align with a designer's preferences.

I personally encountered this problem in Chrome (Version 53.0.2785.101). Although I cannot guarantee, it seems likely that this issue exists in other versions of Chrome as well.

Chrome: https://i.stack.imgur.com/fmNEr.png 'f' and 'i' are combined multiple times

Edge: https://i.stack.imgur.com/rYdkH.png

IE11: https://i.stack.imgur.com/l4Yti.png

In this particular scenario, I sought a solution to disable this feature.

Answer №1

After some investigation, it became clear that achieving this was indeed possible with a bit of effort. According to MDN, you can disable common ligatures by using the following CSS:

font-feature-settings: "liga" 0;

However, a more recommended approach would be to utilize the font-variant-ligatures property instead:

font-variant-ligatures: none;

Both properties achieve the same outcome, but the latter one is preferred.

As mentioned on MDN:

Note: It is advisable for web developers to use the font-variant shorthand property or its corresponding longhand properties like font-variant-ligatures, font-variant-caps, font-variant-east-asian, font-variant-alternates, font-variant-numeric, or font-variant-position whenever possible.

The usage of this property should be limited to specific cases where other methods of enabling OpenType font features are unavailable.

This CSS property should not be employed for enabling small caps in fonts.

Answer №2

I had a similar issue and found my way here via a Google search. I really dislike ligatures appearing on any website. (I noticed that when I convert a webpage to PDF and use the text-to-speech feature, it skips over the ligatures.) Luckily, I discovered a solution that works well for me:

Simply open the webpage using Chrome on Linux (this method may also work on other desktop operating systems). Install the StyleBot extension for Google Chrome. Then, go to its settings, select "styles", and click on "edit global stylesheet". Input the following code (borrowed from the answer by @AwesomeGuy).

body {
font-variant-ligatures: none;
font-feature-settings: "liga" 0;
}

Make sure to activate the global stylesheet. Voilà, Chrome will no longer display ligatures (characters will be shown separately). Additionally, when printing web pages as PDFs in Chrome, characters are displayed individually.

Answer №3

Make sure to save this as a bookmark and only click once when you're ready to print.

javascript: void(function () {
    var css = `
    * {
        font-variant-ligatures: none!important;
        font-feature-settings: "liga" 0!important;
    }
    `;
    var head = document.head || document.getElementsByTagName('head')[0];
    var style = document.createElement('style');
    style.type = 'text/css';
    if (style.styleSheet) {
        /*This is necessary for IE8 and earlier versions.*/
        style.styleSheet.cssText = css;
    } else {
        style.appendChild(document.createTextNode(css));
    }
    head.appendChild(style);
    /*You can opt not to set a delay here.*/
    setTimeout(function () {
        window.print();
    }, 2000);
})()

Instructions on Adding Javascript Applets to Bookmarks in Chrome

Open a New Tab in Chrome. Use Command+T on a Mac, Ctrl+T on a Windows.
Right-click on the Bookmarks Toolbar within Google Toolbar, located on Chrome's New Tab page.
From the contextual menu, select “Add Page”.
Name your Bookmark appropriately. If you need ideas, consider searching for “Baby Names” or choose names like Shepherd, Samson, or even Samsonite for luggage related inspirations.
Paste the Javascript applet into the URL field.
Save your new Bookmark and you're all set to complete this tutorial!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Placing an emblem after the header wording

Within my h1 tag, I have a header text that I would like to display alongside a small icon on the right side. The length of the text can vary, which presents a challenge in alignment. I attempted to use a background image with no repeat, but it ends up p ...

Can an image be allowed to overflow outside of a div without changing the div's size?

Starting Point I am in the process of designing a layout with Bootstrap 4. Here's a rough representation of what I am aiming for: https://i.sstatic.net/7QTpk.jpg And here is the basic structure: <div class="row"> <div class="col-12 c ...

Failed validation for Angular file upload

I attempted to create a file validator in the front end using Angular. The validator is quite straightforward. I added a function onFileChange(event) to the file input form to extract properties from the uploaded file. I then implemented a filter - only al ...

Switching the theme color from drab grey to vibrant blue

How can I change the default placeholder color in md-input-container from grey to Material Blue? I have followed the instructions in the documentation and created my own theme, but none of the code snippets seems to work. What am I doing wrong? mainApp. ...

Placing two tables in an HTML document

I am working on integrating two tables into my web application and I would like them to be positioned on the same row horizontally. <span><table><tr><td>A</td><td>B</td></tr></table></span> <s ...

Can we modify the cell width in knitr and pandoc?

When generating an HTML file using knitr/pandoc to display multiple tables in a loop, how can you ensure that each table has the same total width despite having varying numbers of cells? --- output: html_document: theme: cosmo --- {r results ="asis", e ...

Updating CSS for dropdown menu in Fluent/Fabric design

I am working with a dropdown component from Fluent UI and I am trying to customize the CSS of the dropdown options. Although I can add classes using className to the dropdown itself, I am facing difficulty in styling the dropdown options directly due to th ...

react-datepicker displaying error message "Preventing default action not possible within a passive event listener invocation"

I've integrated the react-datepicker library in portal mode. While it functions well on browsers, I encounter an error when using mobile browser mode. An issue arises stating: "Unable to preventDefault inside passive event listener invocation" Des ...

Passing a value from a prop to a click event that is dynamically created within an SVG Vue.js

Currently, I am in the process of developing a map component using a JSON array and implementing a click event handler for each item. The objective is to toggle the CSS style to color the item when clicked, which is functioning as expected. However, my goa ...

Difficulty with navigation on Chrome for Android (also impacting Bootstrap's website and all other sites utilizing Bootstrap design)

While working on creating a responsive website using Bootstrap, I encountered an unusual issue with navigation specifically in Chrome on Android. After some investigation, I found that the same problem exists on Bootstrap's own website. To see the i ...

Moving icon that appears when hovering over a menu button

Before diving into this, please take a moment to visit the following website to understand my goal: You'll notice there is a noticeable RED arrow positioned below the menu. What I aim to accomplish is... when I hover over a menu button, the arrow smo ...

The sticky navigation bar allows for the overlapping of additional div elements

Here is the HTML AND SCSS(SASS) code for a NAVBAR: <div id="navbar"> <ul> <li><a href="#home">Home</a></li> <li><a href="#main">Main</a></li> ...

Flexbox divs that adapt to different screen sizes

Hello everyone, I need help with a school project where I have to make blocks responsive and change their layout based on screen width. Specifically, above 1024px they should be in 2 horizontal rows, and below 1024px in 2 vertical rows, always spelling out ...

CanvasJS with a see-through background

I am looking to make my CanvasJS background transparent, but I'm having some issues. The backgroundColor property is used in CanvasJS to set the color of the canvas background. When I tried entering "None" instead of a color code, it ended up giving ...

Disabling Javascript in Chrome (-headless) with the help of PHP Webdriver

I am experimenting with using Chrome without JavaScript enabled. I attempted to disable JavaScript by adding the --disable-javascript command line argument. I also tried some experimental options: $options->setExperimentalOption('prefs&a ...

Displaying mysqli results within a div while incorporating an onclick event for a javascript function that also includes another onclick event for a separate javascript function

I'm struggling to figure out the correct way to write this script. Can someone please guide me in the right direction or suggest an alternative method? I've searched but haven't found any relevant examples. I am fetching information from a ...

Creating a blur effect on an image tag when hovering using CSS and HTML

I am currently developing a Portal website for one of my classes, and the template provided by my professor utilizes the <picture> tag to adjust images depending on the browser's size. My goal is to add a blur effect and darken the image while d ...

Stable Banner with Automatic Scroll to Sections

I have implemented a script that allows for smooth scrolling to different sections within a webpage when clicking on links in the top navigation menu. In the HTML, I've assigned IDs to each section (section1, section2, section3, etc.) and linked these ...

Customize the appearance and text in the navigation bar

Currently, I am in the process of creating my own personal website template. However, I have encountered an issue with styling the image and text within the navbar. I am looking to adjust the aspect ratio of the image in order to center it within the n ...

Setting up button value dynamically according to dropdown selection in Angular 2

I'm a beginner in angular 2 and I have a button with a dropdown. When I select an option from the dropdown, I want its value to be displayed on the button. The CSS code for styling the dropdown is provided below: .common_select_box { width: 100%; } ...