In Safari, my layout is disrupted by the mere mention of the word 'City'

There's something strange happening in Safari that I can't quite figure out.

Here's how my layout looks in Chrome:

https://i.sstatic.net/lPhnP.png

But when viewed in Safari, it looks like this:

https://i.sstatic.net/IMnQb.png

For some reason, the

<small class="text-muted">(required)</small>
part of my HTML is being pushed to a new line.

Even stranger, if I change just one letter in the word 'City', everything goes back to normal.

Here's the same section of my form with only one letter changed from 'City' to 'Sity':

https://i.sstatic.net/I9OnA.png

I've noticed that changing the word 'City' to any other word fixes the issue. Simply using 'Town' instead of 'City' resolves the problem. However, I'm curious whether this is an odd bug or if there's something I'm missing.

What could be causing this?

I couldn't replicate this problem in Stack Overflow's code snippet tool.

I'm using Bootstrap 4 and the specific portion of HTML in question is as follows:

<div class="form-row">
  <div class="form-group needs-validation col-sm-6 col-md-6">
    <label for="inputCity">City <small class="text-muted">(required)</small></label>
    <input type="text" class="form-control" id="inputCity" name="city" required>
    <div class="invalid-feedback">
      Please provide your city.
    </div>
  </div>
  <div class="form-group needs-validation col-sm-6 col-md-4">
    <label for="inputState">State <small class="text-muted">(required)</small></label>
    <input type="text" class="form-control" id="inputState" name="state" required
              autocomplete="address-level1">
    <div class="invalid-feedback">
      Please provide your state.
    </div>
  </div>
  <div class="form-group needs-validation col-5 col-sm-4 col-md-2">
    <label for="inputZip">Zip <small class="text-muted">(required)</small></label>
    <input type="text" class="form-control" id="inputZip" name="zip" required>
    <div class="invalid-feedback">
      Please provide your zip code.
    </div>
  </div>
</div>

EDIT Responding to Comments

@Rdg Replacing the space with &nbsp; does indeed fix the layout. But why does this only occur when followed by the word 'City' and nothing else (granted I haven't tested every word in the English language, so could it be something to do with the exact width of the word 'City'?)

@Geuis Yes I have finally managed to recreate this in codepen, it seems to be an issue with the font I am using ("Raleway") and the exact width of the word "City". https://codepen.io/Redtama/pen/RdRpqX

@Richard Uie I'm not sure what you mean by

substitute the HTML entity for uppercase "c," i.e., &amp;#67;
, but with regards to the wrapping being caused by width, I can replace the word 'City' with something much longer and no wrapping takes place.

Example with Longer Label Text https://i.sstatic.net/6mknB.png

Answer №1

Here is a helpful tip to improve your CSS: Try incorporating the following code snippet into your stylesheet to make the text display as an inline element:

.text-muted {
  display: inline-block;
}

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

struggling to locate the file index (I've attempted numerous solutions from various forums with no success...)

Apologies for asking a question that may have been asked numerous times before, but I'm encountering some issues and need your help... Thank you in advance! Here is the HTML form I am working with: <form action="action/actionindex.php" method="po ...

Could a complex, intricate clipping path be created using CSS 3?

Here is an example: Can this be achieved using only CSS? I wish to create two divs: A circle without any background or border. A div with a background. I aim to have point 1 clip the background from point 2. This will allow me to rotate the backgroun ...

Having difficulty selecting an element using XPath based on its title

https://i.stack.imgur.com/Of29v.png My XPath: ((//span[text()='Number of Allowances'])/../../../following::div//table[@class='mainTable']//tr[1]//input[@data-automation-id="numericInput"]) The XPath above clearly specifies that the ai ...

My code seems to be malfunctioning

I'm attempting to conceal the chatname div. Once hidden, I want to position the chatid at the bottom, which is why the value 64px is utilized. However, I encountered an error stating The function toggle3(); has not been defined. <div id="chat ...

Can a small white pop-up be triggered by clicking a button?

While exploring the website , I noticed that clicking on Availability Zones opens a small window with text on the right side of the page. Is it possible to achieve a similar feature on a leaflet map without using JavaScript? This functionality would be tri ...

"Enjoy a unique browsing experience with a two-panel layout featuring a fixed right panel that appears after scrolling

I am facing difficulty in designing a layout with two panels where the left panel has relative positioning and the right panel becomes fixed only after a specific scroll point. Additionally, I need the height of the right panel to adjust when the page scro ...

Struggling with aligning images in the center of a square container

Currently revamping my photography website and working on a simple slider to showcase some of my photos. Struggling with aligning the images in divs with padding all around while keeping them centered. I want to replicate the look of my photos on Instagram ...

Choosing the initial choice with ngFor: A step-by-step guide

I'm having trouble selecting the first option after the user enters their email, but it remains unselected. Any ideas on how to solve this? view image here HTML Code: <label for="login"><b>User:</b></label> <inpu ...

Setting the title of a document in Angular 5 using HTML escaped characters

It seems like a simple problem, but I can't seem to find an easy solution. Currently, I am using the Title service to add titles to my documents and everything is working fine. You can check out the documentation here: https://angular.io/guide/set-doc ...

What could be causing the hover effect to not work on the cards in my Svelte component? (HTML+CSS)

Greetings everyone! This is my debut post on this platform, and I'm in urgent need of assistance as I am relatively new to the world of programming. I've been trying tirelessly to implement a hover effect on these cards, but for some reason, it ...

Prevent automatic scrolling by clicking when you reach the bottom

In order to replicate the issue I am experiencing, please click on the down button four times, and then click on the up button. You will observe that you need to click the up button one extra time for it to function properly. How can I detect when it has r ...

Exploring the world of Bootstrap Twitter 3.0 alongside the wonders of Knockout

When utilizing Twitter Bootstrap, the validation classes like has-error or has-warning must be added to the wrapping form-group element to style both the input and its label. However, Knockout-Validation directly adds the class to the input element itself. ...

JQuery - Triggering mouseenter/hover event only on top-level menu items, excluding the nested submenu items (list items that are not within nested lists)

I have a complex navigation menu structure with nested lists, and I'm struggling to trigger an event only on the top-level items when hovered. Despite trying different jQuery selectors and methods, such as using the NOT selector or targeting direct ch ...

Toggling Bootstrap Tooltip divs within a nested structure triggers the Tooltip of the parent div

I have a setup with 2 nested <div> elements, both utilizing the tooltip() function. When I hover over the inner <div>, the tooltip of the outer <div> also displays. To resolve this issue, I attempted to clear the title of the inner <di ...

Troubleshooting in Next.js 13: Issue with module not being found while trying to reference a package containing CSS

Currently working with Next.js version 13.4.2 and I have included an npm package that comes with CSS styles and fonts. The issue arises when trying to utilize one of the CSS files within my application. In the layout.tsx file, I imported the CSS file as fo ...

The icons from Font Awesome are not displaying properly in Angular version 15

I have been searching for new information to help solve the error I am experiencing but haven't found any useful results. Here is my issue: I am working on a project in Angular 15.1.0 and want to incorporate some Font Awesome icons. To do this, I foll ...

The parent's height dynamically adjusts based on the height of its visible children using only CSS

I am dealing with the following structure: <div class="body"> <div class="wrapper"> <div class="dialog"> <div class="content-0"></div> <div class="content-1&quo ...

Is there a space added after applying overflow:hidden to a div?

.d1 { height: 10px; } .dd { display: inline-block; overflow: hidden; } .dd1 { display: inline-block; } <div class="d1"> <div class="dd"></div> <div class="dd1"></div> </div> To adjust the layout so that th ...

Ensuring the footer stays anchored at the bottom using Material-UI Expansion Drawers

Utilizing Material-UI@next in my React application, I have a component that showcases a list of items using Expansion Panels. Additionally, there is a straightforward <Footer /> component structured like this: import React, { Component } from "react ...

Insert a new <tr> element into a dynamic table using PHP and jQuery without the need to refresh the page

I am attempting to dynamically insert a row into an existing table when a button is clicked. The rows in the table are created dynamically based on data retrieved from a PHP script. My approach involves making an ajax call to the insert_tr.php script, whi ...