Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6245281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:28:38+00:00 2026-05-24T12:28:38+00:00

I’m trying to create a textarea that looks exactly like a div . However,

  • 0

I’m trying to create a textarea that looks exactly like a div.

However, on iOS there’s 3 pixels coming from somewhere that I can’t remove.

Here’s my code:

<!doctype html>
<title>Textarea test</title>
<style>
textarea, div
{
  background: yellow;
  font: 13px arial;
  border: 0;
  padding: 0;
  border-radius: 0;
  margin: 0;

  -webkit-appearance: none;
}
</style>
<div>test</div>
<hr>
<textarea>test</textarea>

This is rendered like so (I’ve zoomed in):

3 extra pixels

As the screenshot shows, there’s 3 pixels before the text that I want to get rid of. As far as I can see it’s not the margin/padding or border.

This happens on my iPhone and iPad, both running iOS 4.3. And to be clear; those 3 extra pixels don’t show up on Safari/Firefox/Chrome on my desktop. Or my brother’s Windows Phone, for that matter.

EDIT 2011-08-10:
I’ve just tested this on a <input type=text> and the same “padding” thing appears, except that it’s 1 pixel instead of 3.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:28:39+00:00Added an answer on May 24, 2026 at 12:28 pm

    Okay… Sorry… Here we go… The officially unofficial answer is…

    You can’t get rid of it.

    Apparently this is a “bug” with mobile safari on inputs. See:

    • <input type="submit"> padding bug on Safari mobile?
    • iPhone <button> padding unchangeable?

    You can, however, knowing the indent do this

    textarea {
      text-indent:-3px;
    }
    

    It’s not a pretty solution, but it does what you need.

    Edit
    Forgot to mention, tested with iOS Simulator. You might try on your phone itself.

    Another point: This also assumes that you’re serving up css solely for mobile safari, specifically for the iPhone. An older way of doing this is:

    /* Main CSS here */
    
    /* iPhone CSS */
    @media screen and (max-device-width: 480px){
      /* iPhone only CSS here */
      textarea {
        text-indent: -3px;
      }
    }
    

    Edit Again
    I’m having way too much fun with this… You can also use separate stylesheets with these declarations:

    <link rel="stylesheet" media="all and (max-device-width: 480px)" href="iphone.css"> 
    <link rel="stylesheet" media="all and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait)" href="ipad-portrait.css"> 
    <link rel="stylesheet" media="all and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)" href="ipad-landscape.css"> 
    <link rel="stylesheet" media="all and (min-device-width: 1025px)" href="ipad-landscape.css"> 
    

    Edit Because apparently somebody bought an Android 😉

    <script type="text/javascript">
    if (navigator.userAgent.indexOf('iPhone') != -1) {
      document.write('<link rel="stylesheet" href="iphone.css" type="text/css" />');
    } else if (navigator.userAgent.indexOf('Android') != -1) {
      document.write('<link rel="stylesheet" href="android.css" type="text/css" />');
    } else {
      document.write('<link rel="stylesheet" href="desktop.css" type="text/css" />');
    }
    </script>
    

    Personally, I don’t really have a problem with text-entries having some internal indentation. It clears it from the area’s edge and makes it more readable. I do, however, believe that a browser should support the spec. So here’s an update for differentiating between android and iPhone. Have fun!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm trying to create an if statement in PHP that prevents a single post
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.