What causes text display issues in Google Chrome when using the jQuery sortable widget?

Exploring front-end technologies like jQuery and CSS is a new adventure for me, but I find myself puzzled as to why the same code displays differently. The code snippet I'm referring to is the example of the sortable widget provided by jQuery.
Interestingly enough, while the text renders flawlessly on Firefox, Chrome seems to have a different interpretation resulting in the text items such as Item 1, Item 2, ... falling outside of their designated spaces as shown in the screenshot below.
Browser Versions: Firefox - 50.1.0, Google Chrome - 55.0.2883.87
https://i.sstatic.net/AH3m9.png

<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Sortable - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <style>
    #sortable {
      list-style-type: none;
      margin: 0;
      padding: 0;
      width: 60%;
    }
    #sortable li {
      margin: 0 3px 3px 3px;
      padding: 0.4em;
      padding-left: 1.5em;
      font-size: 1.4em;
      height: 18px;
    }
    #sortable li span {
      position: absolute;
      margin-left: -1.3em;
    }
  </style>
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
    $(function() {
      $("#sortable").sortable();
      $("#sortable").disableSelection();
    });
  </script>
</head>

<body>

  <ul id="sortable">
    <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 1</li>
    <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 2</li>
    <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 3</li>
    <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 4</li>
    <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 5</li>
    <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 6</li>
    <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 7</li>
  </ul>


</body>

</html>

Answer №1

After some experimentation, I managed to solve the issue. It turns out that my custom font settings in Google Chrome were causing the problem. By reverting back to the default font, everything is now working properly.

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

Exemplary CSS Text Alignment When Vertical Align is Exceptional

I'm currently working on a menu where some text needs to be aligned vertically with the property vertical-align:super. However, I am facing an issue where this particular item with "super" text is not aligning properly with the other items. Below is ...

The JQuery get method fails to send a request to the server

When running the following jQuery code to load a partial page onto a hidden div, everything works fine on my local machine. However, once I add the code to the server, the partial page does not load. Any suggestions on why this might be happening? var u ...

Implement the setInterval method within the function and include additional arguments as parameters

Is it possible to use setInterval in a function and pass parameters? In this code snippet, I am attempting to utilize the red_orange_on variable to achieve this. I want to know if this is the correct approach or if there is a better way to accomplish this ...

JavaScript Geocoding does not initiate the search process

Currently in the process of moving some Google Maps functions to a separate file. In my main file, I have a function search() that sets up a workflow with the other file included. The issue I'm facing is with the geocoder.geocode() function, which was ...

Question about loading images with jQuery

Utilizing the jQuery cycle plugin, I am cycling through a set of images within a DIV element. My main concern is ensuring that the cycle plugin does not begin until all the images have loaded, or at least the initial 4-5 images to prevent any unloaded imag ...

Having trouble getting AJAX or jQuery to function properly on a dynamic select list in my rails4 project

Embarking on a journey into Rails and AJAX with jQuery, I find myself in uncharted territory. My webpage features radio buttons allowing users to select a server. Based on this selection, my first dropdown menu 'dir_list' populates with top-level ...

Using conditional statements with a series of deferred actions in jQuery

In the scenario where I have chained the $.Deferred as shown below: $.each(data, function(k, v) { promise.then(function() { return $.post(...); }).then(function(data) { if(data)... // here is the conditions return $.post(.. ...

I am interested in developing a program using Javascript or JQuery that can effectively capture the anchor text within <a></a> link tags

I want to automatically capture the link on my website and create a system where, when users click on a specific link, it opens the captured link in a new tab without requiring browser permission and replaces the current tab with a different link. For exa ...

"Enhance your website's tracking capabilities by integrating jQuery with

Last week, everything was working perfectly fine and I hadn't made any changes to the code or settings. The google analytics javascript file is loaded using the .htaccess file, ensuring it is consistently used for all pages without any issues. However ...

What is the best way to retrieve EXIF data following the AJAX loading of images?

Currently, I am developing a swipe-able wine image viewer for NapaWapa.com and it's functioning quite smoothly: The challenge I'm facing is related to using a jquery plugin to extract the exif data from the images in the gallery. Unfortunately, ...

React app experiencing an unexpected issue with horizontal scroll bar appearing unnecessarily

Currently, I am attempting to implement a carousel using react-bootstrap within my react application. The goal is to have a black background container where the carousel will reside, similar to this illustration Desired Container However, upon creating t ...

Turn an item by x degrees, not towards x degrees

Is there a way to rotate an object by a specific degree, rather than to a specific degree? I am familiar with using transform/-webkit-transform to rotate an object by a set degree, but I am looking for a method that will rotate my object by the specified ...

Jquery Click function malfunctioning on testing environment

I'm facing a bit of challenge and could really use some assistance. I have this code snippet that functions perfectly in my test document, but once it's uploaded to the live server, everything loads correctly except for the fadeOut click function ...

Changing synchronous functions to asynchronous

Attempting to transform synchronous calls into asynchronous ones using when...done. Despite being new at this, after extensive reading on the topic for the past two days, my code should work as intended. However, while it does function, it doesn't exe ...

Transferring information among PHP web pages using a list generated on-the-fly

I am working with a PHP code that dynamically generates a list within a form using data from a database: echo '<form name="List" action="checkList.php" method="post">'; while($rows=mysqli_fetch_array($sql)) { echo "<input type='pas ...

Working with jQuery: Creating multiple lightboxes using the same jQuery code

Is there a way to create a universal lightbox with the same code for all lightbox functions on the page using JQuery? $(document).ready(function() { $('.lightbox').click(function() { $('.backdrop, .box').animat ...

The cancel button is experiencing unexpected behavior when used in conjunction with the jQuery load event

I'm experiencing an issue with a cancel button on my website. After clicking the cancel button, it cancels the action but then proceeds to reload the page. I attempted to fix this by adding the "preventDefault" method, but it did not resolve the iss ...

Combine object attributes to create a new column in a table

Check out this plunker I created. What is the most efficient way to merge the contents of $scope.blacklist into $scope.friends when ng-click="showColumn('Blacklist');" is triggered, and also add a new column named Coming to the table. Ng-App &am ...

How can JS be used to create content without refreshing the page?

On my website, I have a staff directory where each individual can be selected by clicking on their profile. When a staff member is clicked, a jQuery mobile popup opens and loads dynamic content using AJAX. Within this popup, users have the option to delete ...

Invoke ajax.fail() within the ajax.success() method

Is there a way to conditionally trigger the .fail method from within the .success callback? var myAjaxCall = $.ajax({ url: myUrl, type: "POST", data: myData, dataType: "json", processData: false, contentType: "application/json; c ...