Issue with DIV element wrongly breaking on iPhone Safari and Chrome - fix verified

I am currently working on a basic web application, but I'm facing an issue that's proving to be quite puzzling. When viewed on Desktop Chrome with the display set to iPhone 12 Pro (although I have a 13 Pro), everything looks perfectly aligned in the window:

https://i.sstatic.net/1O9SM.png

However, once the site is deployed onto IIS and accessed from my phone, I see something like this (screenshot taken from my iPhone):

https://i.sstatic.net/tV7fy.jpg

The buttons are contained inside a div element, and here is the CSS code for reference:

.buttons {
  display: flex;
  flex-flow: row;
  flex-wrap: wrap;
  width: 60vw;
  margin: auto;
}

Furthermore, the specific styling applied to the buttons is as follows:

.number {
  width: 15vw;
  height: 15vw;
  margin: 2.5vw;
  font-size: 7.5vw;
  /*border-radius: 20vw;*/
}

This snippet of HTML content illustrates the layout structure:

<div class="content">
  <div class="total">
    Sum Total: {{ sumTotal | currency :'GBP':'symbol':'1.2-2' }}
  </div>  
  <div class="list">
    <span class="amount" *ngFor="let values of listOfValues">
      {{ values.amount | currency :'GBP':'symbol':'1.2-2' }} | <i class="bi bi-trash float-right" (click)="remove(values)"></i>
    </span>
  </div>
  <div class="value">
    <div class="symbol">&pound;</div>
    <div class="box">{{ digit5 }}</div>
    <div class="box">{{ digit4 }}</div>
    <div class="box">{{ digit3 }}</div>
    <i class="bi bi-dot"></i>
    <div class="box">{{ digit2 }}</div>
    <div class="box">{{ digit1 }}</div>
  </div>
  <div class="buttons">
    <button class="number" (click)="add('7')">7</button>
    <button class="number" (click)="add('8')">8</button>
    <button class="number" (click)="add('9')">9</button>
    <!-- Break -->
    <button class="number" (click)="add('4')">4</button>
    <button class="number" (click)="add('5')">5</button>
    <button class="number" (click)="add('6')">6</button>
    <!-- Break -->
    <button class="number" (click)="add('1')">1</button>
    <button class="number" (click)="add('2')">2</button>
    <button class="number" (click)="add('3')">3</button>
    <!-- Break -->
    <button class="number" disabled><i class="bi bi-backspace"></i></button>
    <button class="number" (click)="add('0')">0</button>
    <button class="number" (click)="addAmount()"><i class="bi bi-plus-lg"></i></button>
    <!-- Break -->
  </div>
</div>

If you'd like to view a working demo, check out the following link on StackBlitz, where the buttons appear correctly ordered.

Is there something crucial I may have overlooked in terms of mobile CSS styling? It's perplexing why the mobile view doesn't match the desktop appearance, given that I've calculated each button's width to adjust the total div width accordingly with automatic margins on either side.

Answer №1

To ensure consistent styling across different systems, you should use appearance: none. [source]

To center text when the font size increases, use padding: 0 and specify the text color as black.

.buttons {
  display: flex;
  flex-flow: row;
  flex-wrap: wrap;
  width: 60vw;
  margin: auto;
}

.number {
  width: 15vw;
  height: 15vw;
  margin: 2.5vw;
  
  padding: 0;
  font-size: 7.5vw;
  
  color: black;
  appearance: none;
}

.number[disabled] {
  color: #aaa;
}
<div class="buttons">
  <button class="number">7</button>
  <button class="number">8</button>
  <button class="number">9</button>
  <!-- Break -->
  <button class="number">4</button>
  <button class="number">5</button>
  <button class="number">6</button>
  <!-- Break -->
  <button class="number">1</button>
  <button class="number">2</button>
  <button class="number">3</button>
  <!-- Break -->
  <button class="number" disabled><</button>
  <button class="number">0</button>
  <button class="number">+</button>
  <!-- Break -->
</div>

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

Setting the minimum and maximum width of the MenuItem (popover) in Material-UI based on the width of the select component

I need the popover width to always match the width of the select component, regardless of the length of the text in the menu items. Setting autoWidth to either true or false is not providing a solution. Below is the code for the select component: import ...

Displaying random characters in place of Angular 6 font awesome icons

Recently, I started a new project with the angular cli and incorporated font-awesome 4.7.0. After that, I included it as a dependency in my angular.json file. "styles": [ "./node_modules/font-awesome/css/font-awesome.min.css", "./node ...

How can the edit feature be implemented in AngularJS?

I am struggling with implementing an edit field in AngularJS. Can someone please help me with this? Here is the code for my CRUD operations: var app = angular.module('myApp', []) app.controller('myCtrl', ['$scope', functio ...

A unique and dynamic design concept for my website: a zigzagging structure

I am trying to achieve a layout similar to the one at the provided link, with variable sized div tags on the left and right edges. Can someone please assist me in styling the left and right sides accordingly? Key styles I have used: .rightside { margin-l ...

Questions about syntax: What is the correct course of action?

If there is a child inside a div with an id, such as id="mother", how should the css be written correctly? Example: 1) #mother ul li {...} or 2) .mother ul li {...} Is there a difference? The second example I came across when MOTHER had a class name, ...

What is the best way to ensure the right six-column DIV remains at the top in responsive web design?

I have implemented a custom 12-column grid and have created a row structure as follows: <div class="row"> <div id="the-pink" class="lg-6 md-12 sm-12"><!-- content --></div> <div id="the-violet" class="lg-6 md-12 sm-12"&g ...

How can I permanently disable a Bootstrap button on the server side using PHP after it has been clicked once?

I am in search of a way to disable a bootstrap button permanently after it has been clicked once. While I am aware of how to achieve this on the client side using JavaScript, the button becomes enabled again after the page is refreshed. I am now looking ...

Show various perspectives depending on the circumstances

I am looking for a solution to display a different component if my ngFor loop returns null. <ion-select interface="popover" [ngModel]="selectedKidId"> <ion-option *ngFor="let kid of kids" [value]="kid.id">{{kid.name}}</ion-option& ...

Dynamic SVG circles with timer and progress animation

Is there a way to modify the following: var el = document.getElementById('graph'); // get canvas var options = { percent: el.getAttribute('data-percent') || 25, size: el.getAttribute('data-size') || 220, lineW ...

Trouble with image size transition not functioning properly

When attempting to enlarge an image with a transition in Chrome, it doesn't seem to be working properly. Here is the HTML code: <img src="foobar.png"> And the CSS code: img { float: left; margin-right ...

Display all attribute connections for a product in Prestashop

I have updated the products in my shop to include different combinations. These combinations involve a 'packaging' attribute with two options: a 100 units box and a 200 units box, each with its own unique reference number. On the product page, t ...

Tips for correctly center aligning a Div element

I'm facing some challenges with properly centering my website It appears to be centered when I zoom out. However, for users who don't zoom out, it looks misplaced. Do you have any suggestions? The site was built using all AP divs and even with a ...

Is there a way to incorporate pseudo-dynamic css into my projects?

I'm struggling with managing custom colored elements on my website. For instance, I have a hundred navigation squares on the site, each with its own unique color. The only solution I can think of is creating separate CSS classes for each color, but t ...

Creating a customized tooltip without the need for calling $(document).foundation() and using modernizr

I'm facing an issue with initializing the foundation tool-tip without having to initialize everything (such as $(document).foundation()). It seems like a simple task, but I am struggling. I have two questions in mind: (1) How can I utilize new Founda ...

What is the process for utilizing datePipe in an Angular component?

How can I implement DatePipe in my Angular component? This is the code snippet that I am currently using. for (let i = 0; i < this.days.length; i++) { this.storeStart(this.days[i], null, null, null); } I have stored weekdays (Monday to Frid ...

Discrepancy discovered in Bootstrap 5 container dimensions compared to provided documentation

I am currently delving into Bootstrap 5 (I have some experience with coding but not much with web technologies). To better understand how Bootstrap works, I've been creating HTML documents to experiment with its behavior. While working on the "conta ...

The significance of tabindex in CSS

Is it possible to manipulate tabindex using CSS? If so, which browsers support this feature and on what types of elements? UPDATE I am interested in capturing keydown events on a div element. After researching keyboard events on http://www.quirksmode.org ...

Pass the value of the search input to child components in Angular 2

Within my Angular 2 application, I am faced with the task of sending the value from an HTML search input to 3 child components only when the user pauses typing for 300ms and has entered a different value than what was previously in the input field. After r ...

Consistent manipulation of the DOM through the Drag/Touchmove event

Seeking to incorporate Mobile Components through native Javascript and AngularJS. During my work on developing a Pull To Refresh directive for AngularJS, I utilized the touchmove event on a UL list. The goal was to pull a concealed div over a list with cu ...

Guide to monitoring updates to a universal server-side variable in Angular 2

I am currently developing an application using Angular 2 with Electron and Node. The tests are executed on the server, and the results are stored in a global variable array named testResults. I am able to access this array in Angular by using: declare var ...