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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:27:29+00:00 2026-06-09T05:27:29+00:00

I have a select dropdown menu that has a fixed width with a percentage.

  • 0

I have a select dropdown menu that has a fixed width with a percentage. And I have a custom button on it. What I want is regardless of select’s current width, I want the button to stay 20 pixels away from the right side. But I couldn’t find a way to do that because if I use % in background-position property, the button goes far and far when the window is large. And also obviously I can’t use pixels because I’d have to set it for a certain width.

html

<div class="selector">
    <select id="layer" name="layer" class="select-button">
        <option value="0"> 0
        </option>
        <option value="1"> 1
        </option>
        <option value="2"> 2
        </option>
        <option value="3"> 3
        </option>
    </select>
</div>​

css

.selector > .select-button {
background-image: url("../img/actions.png");
background-repeat: no-repeat;
background-color: #ffffff;
background-size: 20px 15px;
background-position: 95% 50% ;
float: right;
width: 45%;
font-size: 16px;
border: 0;
height: 50px;
border-radius: 10px;
border: 5px solid black;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}​

Here’s a
demo

I used a random image to demonstrate it better. As you can see if you widen the window the button position changes since it’s set in percentage. I want to make the button positioned absolute 20px away from right side regardless of viewport size, but don’t know how I can achieve that.

  • 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-09T05:27:31+00:00Added an answer on June 9, 2026 at 5:27 am

    You can:

    • add 20 transparent pixels to your image on the right
    • update background position with jQuery.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a select element that functions as a dropdown menu. Each option has
I have a nested form that has a select dropdown menu. How can I
I have a simple html option/select (dropdown) menu. I want to use JQuery to
I have a form that has a dropdown menu i need the user to
I have a form that has a select menu(A) and 2 divs (B and
I have a css dropdown menu with an HTML select form inside of that
I'm building a Zend form that has a dropdown/select menu populated with data from
I have some code that first selects an option value in a dropdown menu
I have a little dropdown menu similar <select> , which contolled from external js-function.
I have a simple dropdown menu: <form class=feedmenu align=center> <select onchange=showRSS1(this.value)> <option value=>Select an

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.