The arrangement of tables is influenced by the choice of font

It seems that using Google's Dosis font is causing issues with table layout:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
        <title>Test</title>
        <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Dosis" />
        <style type="text/css">
            table {
                width: 100%;
            }

            td {
                outline: 1px solid red;
            }

            #test {
                font-family: "Dosis";
            }
        </style>
    </head>
    <body>
        <table id="test">
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
                <td>5</td>
            </tr>
        </table>
        <table id="control">
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
                <td>5</td>
            </tr>
        </table>
    </body>
</html>

In the scenario above, cells in the table with the Dosis font appear unevenly spaced, while those without a specified font family are displaying as expected.

Surprisingly, this inconsistent behavior occurs consistently across Firefox, Chrome, and Opera.

Can someone please provide an explanation for this, and potentially offer a solution?

Answer №1

I believe the reason for this difference in width is due to the values of 1,2,3,4,5 not being equal. Explore further by replicating the same scenario:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
        <title>Test</title>
        <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Dosis" />
        <style type="text/css">
            table {
                width: 100%;
            }

            td {
                outline: 2px solid red;
            }

            #test {
                  font-family: 'Dosis';

            }
        </style>
    </head>
    <body>
        <table id="test">
            <tr>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
                <td>1</td>
            </tr>
        </table>
        <table id="control">
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
                <td>5</td>
            </tr>
        </table>
    </body>
</html>​​​​​​

To manage the width of td tag uniformly, consider using CSS adjustments or JavaScript functionalities for dynamic allocation.

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

Converting HTML to DOC with PHP

Looking for a way to convert an HTML file into a DOC format. Currently using html2pdf for PDF conversion. Does anyone know of a similar library that can convert HTML to DOC? Must be free or open source. (PS must be free/open source) EDIT Received feedb ...

Customizing Your Keyboard Design with CSS

I need assistance in creating a compact and dynamic keyboard layout with characters only, but I have hit a roadblock. Here is the link to my current progress: http://jsfiddle.net/45zDd The design is almost complete, however, the second and third rows req ...

Chrome page loading with smooth color transitions

Setting global colors on links and transitions on their color: a { color: blue; transition: color 300ms linear; } Later in the code, there's more specific styling for links in the navigation: nav a { color: red; } nav a:hover { color: black; } ...

Selecting parent class using JQuery

This is some HTML I have: <label class="rlabel">First Name</label> <input class="rinput" type="text" placeholder="Fisrt Name" required /> <label class="rlabel">Last Name</label> <input class="rinput" type="tex ...

Easily toggle between various image source paths

In my current application, all HTML files have hardcoded relative image paths that point to a specific directory. For example: <img src="projectA/style/images/Preferences.png"/> Now, I am considering switching between two different project modes: & ...

The object with the tag HTMLAnchorElement is unable to access the 'attr' method

I need to add the URL from the browser before each menu item due to some URL redirect issues. However, I am encountering an error in the code snippet below. What am I doing incorrectly? What is the correct approach? $(window).load(function () { ...

What is the process for creating a beveled edge on a block div?

I am working on an HTML document that includes a DIV tag with specific styling: <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>DIV Tag</title> <style type="text/css"> ...

The styling of PrimeNG Element cannot be directly applied using the default Angular 2 ViewEncapsulation (Emulated) as it is not scoped

Attempting to utilize the styleUrls property in my Angular 2 component for leveraging View Encapsulation has presented an issue when new elements are inserted into the DOM post-Angular initialization. The problem arises with a PrimeNG paginator that lacks ...

Links arranged in semicircles along the perimeter of the page

Here is some code that I have created to display two links in circles positioned on the left and right sides of a webpage. [class*="navigation"] .nav-previous, [class*="navigation"] .nav-next { position: fixed; z-index: 999; top: 50%; text-align ...

Unable to switch the text option

[Fiddle] I'm currently working on a project where I want pairs of buttons to toggle text by matching data attributes. While I can successfully change the text from "Add" to "Remove" on click, I am facing an issue with toggling it back to "Add" on the ...

animate the alignment of right-aligned text to move to the right side and realign to the left

I need help with a small menu-list that should expand when the mouse is nearby. By default, the menu is aligned to the right, but on hover, every other item shifts to the left to accommodate the increased height (check out the JSFiddle). ul { font-siz ...

Retrieving specific value from a Parent Controller in AngularJS using UI Router

I have a request to display the value stored in $scope.resAVal on my index.html page. This value is accessible within the RootCtrl. index.html <!DOCTYPE html> <html ng-app="plunker"> <head> <!-- any required JavaScript librarie ...

Ensure that all buttons within a table data cell are displayed in the same line, while still keeping them small in

I have a challenge with my table layout as I am using tables to display tabular data from my app listings. Within each row, the first cell contains several buttons for users to interact with the record (such as edit, delete, view details, etc...). The nu ...

Arrange the side by side display of uploaded image previews

Could someone please assist me with aligning my image upload preview in a row, similar to a brand/partners slider? The current preview output is not displaying as desired. Here is the code I have: <div class="image-gallery"> <div class ...

Adjust image placement when resizing the window or rotating a mobile device

When the window is maximized or the phone is in portrait position, the magnifying glass stays in its place. However, when I resize the window or rotate the mobile phone, the position of the magnifying glass changes. I've tried using different units ...

Why does the Bootstrap Modal only appear on one page and not the other?

Currently, I am working on coding a website with Bootstrap. On one page, I have successfully implemented a modal (check it out here), but on the other page, the modal doesn't seem to show up (here). There is a button on that page for editing ban detai ...

Fluid Grid System with columns of specific dimensions

Recently delving into the world of Foundation Framework, I've just begun utilizing it for my projects. My current task involves crafting a responsive design with the help of the Foundation Grid system. Specifically, I've set up a grid layout for ...

Achieving Horizontal Alignment in a Dropdown Menu with Bootstrap 4

I am utilizing a dropdown that contains 3 main "categories", each with multiple checkboxes for filtering search results. Below is an example: <div class="dropdown"> <button type="button" class="btn dropdown-toggle" data-toggle="dropdown">B ...

Steps for Displaying Error Message when Search Result is Not Found in a JavaScript Table

After creating a table using HTML to display student data like name, degree, and profession, I added a search bar for users to find information on a specific student by typing the student's name. If the student is not in the table, a message "Result n ...

Cease and Begin Page Overflow / Scroll with a Single Click Feature

Background: I recently followed a tutorial on how to create a lightbox using HTML, CSS, and JavaScript. However, I encountered an issue where I wanted to disable the scrollbar functionality when the lightbox is displayed, preventing users from scrolling ...