CSS Tip: Eliminate unnecessary white space in text areas on iPhone devices running iOS 10

Can anyone help me with a formatting issue I'm facing? I want the text inside a textarea to appear exactly like the text inside a div element, including padding and other styles.

The code below seems to work fine on my Windows Chrome browser. However, when I check it on an actual iPhone (using Safari or Chrome, OS 10), there is extra space added inside the textarea, resembling left-padding even though it's set to 0. Any ideas on how I can remove this extra space?

(I didn't encounter this problem in iOS 9.)

<style>
.my_area{
  margin: 0;
  padding: 0;
  outline: 0;
  border: 0;
  box-sizing: border-box;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: arial;
  font-size: 17px;
  line-height: 26px; 
  width: 200px;
  overflow: hidden;
  background: yellow;
  border: 1px solid black;
  border-radius: 0;
}
</style>

<textarea class = "my_area">q w e r t y u i o p a s d f g h j k l z x c v b n</textarea>
<br/>
<div class = "my_area">q w e r t y u i o p a s d f g h j k l z x c v b n</div>

Edit: I use

width=device-width, initial-scale=1.0 

in the header so I'm viewing the page at proper resolution for mobile.

Answer №1

As mentioned in the comment, it seems that finding a solution is quite challenging.

To address this issue, I decided to include 3px of left and right padding for the element specifically on iOS devices. Surprisingly, this adjustment worked well on both iPad and iPhone.

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

Adaptive search bar and components housed within a casing

I am struggling to create a responsive box with a search feature for a mobile website. My plan is to incorporate jquery functions into the site, so I need to design an outer container that will house a distinct logo and search bar. However, when I test thi ...

Finding the Solution: Unraveling an Image String with Python

I need help decoding an image string. For example, I have a string that represents the Google logo. How can I determine the encoding used and decode it correctly? Example of google logo : (Here you will find instructions on styling properties followed by ...

Tips for replacing spaces with &nbsp; in a string using ReactJS and displaying it in HTML

<div className="mt-2 font-sidebar capitalize"> {item.title} </div> item.title can vary and be any string retrieved from the backend, such as "all products", "most liked", "featured items", etc. I am looking for a solution to subst ...

Blurred border encircling a CSS circle styled with overflow: hidden;

Take a look at the JSFIDDLE of my cat animation without any drop-shadows to highlight the issue clearly. The problem appears to be related to the use of border-radius and possibly due to overflow: hidden. Just to clarify, the owl is not the focus of this ...

Changing the CSS class of list items in a navigation: Tips and tricks

Looking to create a navigation menu that changes the CSS class to 'active' when selected? Take a look at the code below: <ul class="smallmenuContainer"> <li><a class="active" href="index.html#red">Home</a></li&g ...

Steps to create a clickable button wrapper label in React

Contained within the components below: <CheckboxGroupLabel htmlFor={option.label}> <FormCheckbox onClick={() => onChange} key={option.label} defaultChecked={defaultChecked} {...rest} /> {option.value} ...

Navigating with AngularJS

My server is utilizing angular for routing purposes. It sends a HTML file containing a js file with routing using angular js to the browser. Here is the server code (which sends the check.html with the routing file main.js) : var express = require("expre ...

Use Bootstrap to effortlessly arrange columns horizontally in a row

I'm facing a scenario where I need to arrange the columns in a row horizontally. The challenge is to ensure that the row expands horizontally to fit the columns. I attempted to use white-space: nowrap on the row, remove floats on columns, and set the ...

steps for executing a Google script

In my program, the structure is as follows: // JavaScript function using Google Script 1. function F1() { ...... return (v1); } // HTML code for Google 1. <script> 2. function F2() { 3. alert ( 1 ); 4. function F2(); 5. alert ( 2 ); 6 ...

Tips for populating an HTML input with the value of a link element using JQuery

I have a form input that I want to populate with autocomplete suggestions from my database using Ajax. To style the list, I am using bootstrap 4, and I have opted to use the <a></a> tag instead of the <li></li> tag. This is because ...

Reposition the navbar nav to the top right corner of my website using Boostrap

I'm completely new to this subject. Currently, I've been following an online tutorial on HTML/CSS/Bootstrap. One thing I want to do is move the navbar to the top right of the page, like what you see in the image below. I manually added a mockup ...

Issue with connecting Drupal 8 theme styling to website pages

Although the theme is functioning properly, the CSS styles are not being applied. Even when inspecting the developer console in Firefox, there seems to be a disconnect with the page. I verified that manually applying the CSS through the developer console i ...

Using JavaScript arrays to populate an HTML form

I am new to JavaScript, although I have some experience with Python, and I find it challenging to integrate JS with HTML. I am attempting to convert an array into an HTML dropdown list, but I am struggling to make it function correctly. <HEAD> ...

The Jquery ajax request fails to function properly once the webpage has been published live

We've implemented a basic jQuery ajax call. A "more" button triggers a call to another PHP file when clicked. While it worked fine on my local server and initially on the live server, it suddenly stopped working live. The code functions perfectly o ...

Angular's scope allows for the application of CSS classes exclusively to the first div element

Every 2 seconds, a JavaScript function is being called that updates a specific div on the view when a certain condition is met. <div id="ball_{{ballIndex}}">{{ball}}</div> This is controlled by the ng controller. var myCounter = 0; ...

tips for concealing the sorting icon in the DataTables header upon initial load

Is there a way to initially hide the datatable sorting icon upon loading, but have it display automatically when clicking on the header? I've been searching for a solution without success. https://i.sstatic.net/o2Yqa.png ...

What is the best way to transfer a variable from the Cold Fusion back-end page to the HTML front-end section within a CFM file using jQuery Ajax?

My cfm file contains the necessary logic to extract a PDF and convert it into an image file. Now I am looking to pass the file path of this converted image to the front-end CFM so that it can be set as the source for the image tag below. <img id="image ...

Retrieve information from the selected row within a table by pressing the Enter key

I have a search box that dynamically populates a table. I am using arrow keys to navigate through the rows in the table. When I press the enter key, I want to retrieve the data from the selected row. For example, in the code snippet below, I am trying to ...

Utilize JavaScript and jQuery to extract the selected text's context from a webpage

I'm looking to extract the contextual information surrounding a selected text on a web page, specifically the 25 words before and after it. I've tried using JavaScript and jQuery with the following code snippet but unfortunately, it doesn't ...

Position two div elements so that the second div expands to occupy the entire available space

I am struggling with aligning two divs within a container div, one on the left and one on the right. I am using flexbox for alignment purposes, as shown in the code snippet below. .box { display: flex; align-items: center; just ...