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 7952317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:49:31+00:00 2026-06-04T02:49:31+00:00

I need to horizontally center text in a select list, specifically for android and

  • 0

I need to horizontally center text in a select list, specifically for android and iphones. It seems this cant be done with CSS so im looking for a workaround.

I was thinking about hiding the input behind a div with centered text, and using JavaScript to select the input when you click on the div. I would then need to change the text in the div to equal that of the selected option. If the div was created with JavaScript then the page would will be usable with JavaScript disabled.

I had another idea but this seems trickier to me. I could use JavaScript to get the screen width, apply a calculation, and then apply the right amount of text indentation to the input.

Im interested in best practice but this is a demo project not a live one. Im using jQuery. Thanks

UPDATE – Ive tried the following, where the div#cover covers a select input. It works fine in my iPad. However my old Android wont always focus on the input. Firefox does focus on the input but the options dont fly you, you have to scroll them with arrow keys. So it seems this solution is not as simple as id hoped.

$('div#cover').click(function(){
  $('#select').focus();
});
  • 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-06-04T02:49:33+00:00Added an answer on June 4, 2026 at 2:49 am

    Code is from here: jQuery – function runs fine when fired on div click, but not on page load

     function textIndentFunc () {
    
        textString = $('#from-1 :selected').text();
    
         $('#hidden').text(textString);
    
         textWidth = $('#hidden').width();
    
         inputWidth = $('#from-1 select').width();
    
         indentMy = (inputWidth / 2) - (textWidth / 2);
    
        $('#from-1').css('text-indent',indentMy);
    
    }
    
     $('#from-1 select').change(function() {
        textIndentFunc();
     });
    
     textIndentFunc();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need to center the navigation links inside the div, and align it horizontally.
I need to center an element both vertically and horizontally and the element can't
I have problem with text wrapping. Without StackPanel this TextBlock works, but i need
So I have this and want to center it vertically and horizontally: <div id=hd_hype_container
I need your help - I have this CSS and HTML; I need the
I would need to build a html table that has a horizontally scrollable column.
My page has 3 divs that are located horizontally. I need to make the
I have a horizontal <ul> and I need to center each <li> in it
Below is the simple layout. I need help with this because when I scaling
I can horizontally align a div and all the content looks nice. Looking to

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.