What is the best way to ensure the website title is displayed properly on a mobile browser?

Concern

I have been encountering difficulties while constructing a portfolio website using bootstrap 5. The issue arises with the navbar, causing the Title to overlap the hamburger menu and extend beyond the edge of the screen. Strangely enough, this problem is only present on Firefox and Safari browsers on my iPhone 11. Upon testing the website on a Samsung Note and iPad pro, both displayed correctly. Additionally, the fiddle I linked below displays the navbar properly as well. It's perplexing why only the browsers on my iPhone are failing to render it correctly.

Initially, the navbar appeared correctly until I noticed that the font size was too small on mobile devices. In search of a solution, I came across this thread on stack overflow, which suggested adding a meta tag in the head section:

<meta name="viewport" content="width=device-width, initial-scale=1">

While this fixed the font size issue on mobile, it led to misbehavior of the navbar on Firefox and Safari on my iPhone 11. The webpage body appears fine, but the navbar is distorted as depicted below:

Mobile Browser (iPhone 11 - firefox/safari)

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

For comparison purposes, here is how the same code renders on a desktop browser at the lowest window size, showing the intended layout:

Desktop Browser

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

Hence, I am striving to uncover why the iPhone 11 exhibits incorrect rendering behavior compared to other devices and browsers.

Code

Fiddle

https://jsfiddle.net/GeorgeCiesinski/6c579nt4/8/

HTML

<nav class="py-3 navbar navbar-custom navbar-expand-lg autohide navbar-dark">
  <div class="container">
    <a class="navbar-brand" href="#">
      <img src="./assets/logo.svg" class="logo" alt="logo"/>
      George Ciesinski
    </a>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="SupportedContent">
      <ul class="navbar-nav ms-auto">
        <li class="nav-item">
          <a class="nav-link" href="#hero">Software Development</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#about">About</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#projects">Projects</a>
        </li>
        <li class="nav-item">
          <a class="nav-link"
          href="https://georgeciesinski.github.io/blog/">Blog</a>
        </li>
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
            Resume
          </a>
          <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
            <li><a class="dropdown-item" href="assets/PDF/GeorgeCiesinskiResume.pdf" target="_self">PDF</a></li>
            <li><a class="dropdown-item" href="https://georgeciesinski.github.io/resume/">Website</a></li>
          </ul>
        </li>
      </ul>
    </div>
  </div>
</nav>

CSS


@media only screen and (max-width: 850px) {
  .container > .navbar-brand .logo {
    font-size: 1rem;
    display: inline-block;
  }

  .navbar-toggler {
    position: absolute;
    top: 0px;
    right: 0px;
    border-color: none;
  }
  .navbar-brand > img {
    margin-right: 0rem;
  }
}

nav {
  background-color: var(--navbar_color);
}

.navbar-brand img {
  max-height: 50px;
}

.navbar-brand {
  font-size: 24px;
  text-transform: uppercase;
  font-weight: 900;
}

/* Navbar Site Title */

.navbar-custom .navbar-brand,
.navbar-custom .navbar-text {
  color: var(--navbar_logo_text);
}

.navbar-custom .navbar-brand:hover {
  color: var(--navbar_logo_text_highlight);
}

/* Navbar Links */

.navbar-dark .navbar-toggler-icon {
  color: var(--navbar_logo_text);
}

.navbar-nav .nav-item .nav-link {
  color: var(--navbar_text);
}

.navbar-nav .nav-item.active .nav-link,
.navbar-nav .nav-item:hover .nav-link {
  color: var(--navbar_text_highlight);
}

/* Navbar Dropdown Menu */

.navbar-nav > li > .dropdown-menu {
  background-color: var(--navbar_dropdown);
}

.navbar-nav > li > .dropdown-menu a{
  color: var(--navbar_dropdown_text);
  margin: auto 0px !important;
}

.navbar-nav > li > .dropdown-menu a:hover {
  background-color: var(--navbar_dropdown_hover);
  margin: auto 0px !important;
}

nav ul li a {
  color: #a9a9a9;
  font-size: 22px;
  margin: auto 10px;
}

Suggested Resolutions

In an attempt to address the issue, I explored suggestions found in this thread on stack overflow, yet unfortunately, none of the proposed solutions proved effective for me.

Furthermore, I delved into the documentation provided by Bootstrap 5 regarding navbars and experimented with various navbar classes. My quest involved finding a method to reduce the font size of the website title on certain browsers or dynamically adjust its size for compatibility. Regrettably, none of the methods attempted managed to resolve the discrepancy.

Desired Outcome

My goal is to attain uniformity between the layout and appearance of the navbar from my desktop browsing experience and the screenshot representing the same on a desktop browser. While the font size seems consistent between the two scenarios, achieving alignment in their behavior across different platforms would be ideal.

Answer №1

After testing on my phone instead of relying solely on developer tools, I noticed your issue with the link. To solve this problem, consider incorporating media queries into your navbar elements. Here is an example of how to use media queries for a typical mobile browser:

@media only screen and (max-width: 850px) {
  .container > .navbar-brand .logo {
    font-size: 1rem;
    display: inline-block;
  }

  .navbar-toggler {
    position: absolute;
    top: 0px;
    right: 0px;
    border-color: none;
  }
  .navbar-brand > img {
    margin-right: 0rem;
  }
}

Feel free to make adjustments as necessary since I haven't seen the actual frontend appearance either through a fiddle or my phone. This should set you in the right direction.

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

Decoupling the Top Navigation Bar from the Side Navigation Bar

I currently have a top navigation bar with some menus and a side navigation bar with additional menus. I have applied styling to the vertical navigation bar, but it seems to be affecting all the navigation bars, resulting in an output as shown in the image ...

Manipulating child classes using jQuery

I am struggling to display an X icon next to a tab on my page when the tab is clicked, but I am facing difficulties in toggling its visibility. The issue arises when trying to access the span element within the tabs. $('.tabs .tab-links a').on(& ...

Having Trouble with JQuery Triggering Tabs inside an iFrame

I am curious why this code functions properly on my parent's HTML page: $("#assessmentsTab").trigger("click"); but fails to work within my iFrame: $("#assessmentsTab", window.parent.document).trigger("click"); Does anyone have any suggestions? I ...

Applying CSS to replicate the vintage iPhone app icon design

I've been searching online for days, but I can't seem to find any helpful resources on how to use CSS3 to style the old iPhone app icon. My goal is to apply a CSS3 style to this curved line, with a fallback option in case older browsers don&apos ...

The horizontal layout for the Bootstrap 3 sub menu is not displaying beneath the dropdown as expected

Check out my testing site here. I envision the navigation of my website to look like this in the near future, albeit at a lower resolution. While experimenting with the inspector tool, I noticed that changing the display property to inline-block causes t ...

CSS not being applied to certain HTML elements due to an error in implementation

Utilizing Bootstrap's vue form-group has been instrumental in my creation of input fields. I am currently attempting to apply specific CSS styling to the 'legend' element within the following code: <fieldset id="__BVID__59" class="form-g ...

Is there a way to extract all the aria-label attributes from elements that share a common class?

I am currently working on a program that tallies the number of reactions from Facebook posts, with each reaction stored in an aria label containing detailed information. I am encountering difficulty retrieving the values of these unique aria labels due to ...

The data in MongoDB is organized using unique identifiers called ObjectId

I am currently working on a MEAN Crud project and encountering some issues. Despite the data being received in the mongodb, it is displaying as an objectId instead of the actual content. You can see this issue in the image below: https://i.stack.imgur.com ...

Do not decode HTML content within an iframe; instead, extract the data directly from the HTML source

To expedite execution time, we have made the decision to not display the table in the iframe as it is invisible to the client. However, we still need to update the main page table by copying its contents. The approach we are taking is that the iframe shou ...

An effective method for transferring form input and music between pages utilizing JavaScript

I've been grappling with this issue for quite some time now. On the initial page, I have a form like this: <form id="user" name="user" method="GET" action="the-tell-tale-heart.html"> Name: <input type="text" name="name"> & ...

Bootstrap slider with fading in and out effects

I am attempting to create a bootstrap slider that fades in and out when transitioning between slides, similar to the effect demonstrated in this template.. I am using Visual Studio 2010 with ASP.NET. The issue I'm facing is that when the image change ...

CSS code causing issues with table cellpadding functionality

I am currently working on a webpage that is utilizing a pre-existing stylesheet. This particular stylesheet includes the following style rules: table { border-collapse: collapse; } th, td { padding: 0; } My challenge arises when I attempt to cre ...

Form Validation in JavaScript Continues to Submit Form Even When 'False' is Detected

Here is the issue at hand - I am restricted to using older browsers (IE8 and FF8) by corporate policy. Despite my research indicating otherwise, it seems like this might be the root cause of my troubles. My current setup includes PHP 5.5.12 on Apache 2.4. ...

Introducing a fresh new feature incorporating various div elements through the power of JQuery

Why am I unable to retrieve the text of the newly added child divs? I am using JQuery to dynamically add these elements. Here is my sample fiddle: JSFIDDLE Could someone please guide me on what mistake I made? Javascript Code: var counter = 0; $("butto ...

A guide to transforming rows into columns with CSS

Hello, I am trying to convert rows into columns using CSS. Currently, my code looks like this: <style> .flex-container { max-width: 500px; width: 100%; display: flex; flex-wrap: wrap; } .flex-item { ...

Showing various SQL data fields within a single HTML column

I am facing a challenge with displaying multiple checkboxes from different columns in a database as a single column on a webpage. Here is the HTML form structure: <div class="form-group"> <label class="col-md-2 control-label">R-1 ...

Is it possible to use a figure tag as a fancybox link?

I am curious, is it possible to turn a figure tag into a fancybox link with just a background image and no content? I understand that this may not be recommended, but I am wondering if it can actually be achieved? <figure class="appear"><a class= ...

Color the area entirely in black

I am currently working on a project for one of my courses, where I have created a website for a specific service. However, I am facing some challenges and things are not going as smoothly as I had hoped. Here is a screenshot of the page: https://i.stack.im ...

Using CSS absolute/relative positioning in a flyout menu: Utilizing specific parent properties (such as left, top, width, vertical/horizontal alignment) while disregarding others

I recently encountered a common issue in CSS involving flyout menus with sub-menus that are shown on hover. When attempting to position the sub-menu directly below the parent list item, I used position:relative; on the parent item and position:absolute;top ...

Retrieve the server code periodically and automatically refresh the form elements

Let's kick things off by explaining how the application functions: (please note there are multiple users on the page such as Patient M, Patient E, and so forth) 1) Check In: Next to Patient X's name, you will find a button labeled Check In. This ...