`select tag's down-arrow misalignment`

Within my form, there is a field for entering the City Name. However, I am currently experiencing an issue with aligning the down-arrow. As of now, I have aligned it to the right using the background property.

This is how it looks:

background: url(http://cdn1.iconfinder.com/data/icons/cc_mono_icon_set/blacks/16x16/br_down.png) no-repeat right white;

https://i.sstatic.net/kwbw0.png

Unfortunately, the arrow is touching the border of the div. My goal is to add some spacing from the right so that there is equal spacing all around.

I have attempted adding padding, margin, left, and right properties, but the entire div shifts along with the city code.

Could someone please help me identify the exact issue here?

EDIT: Added snippet of the code

.cityName {
    display: flex;
  max-width: 300px;
  margin: 0 auto;
}

.form-inputs{
    background: #FFFFFF;
    border-radius: 5px;
    height: 50px;
    width: 100%;
    padding: 0 10px;
    font-weight: normal;
    font-size: 18px;
    line-height: 21px;
    color: #445566;
    margin-bottom: 10px;
}

.cityName select {
    width: 90px;
    margin-left: 10px;
}

.cityName select.city-short{
    position: relative;
    background: url(http://cdn1.iconfinder.com/data/icons/cc_mono_icon_set/blacks/16x16/br_down.png) no-repeat right white;
    background-size: 10px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
<label for="lastName" class="cityName">
   <input type="text" id="cityName" placeholder="Enter City Name" class="city validated form-inputs">
   <select class="city-short form-inputs">
      <option selected="" value="" >NA
      </option>
      <option selected="" value="" >US
      </option>
   </select>
</label>

Answer №1

To modify the background position size for the background property, you can include the following code:

background: url(http://cdn1.iconfinder.com/data/icons/cc_mono_icon_set/blacks/16x16/br_down.png) no-repeat right 10px center white

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

HTML table's horizontal width does not match the header's size

I'm having an issue with my HTML table. The rows are not aligning properly with the header width. Can anyone help with fixing this? I'm not very familiar with CSS, so any guidance would be greatly appreciated. Here is an example of the HTML sour ...

What is the best way to trigger the opening of this modal after a certain amount

I'm currently working on a CSS and HTML modal and I'd like it to appear 3 seconds after the page loads using jQuery. I'm struggling to find the right event handler for this task. How can I achieve this effectively? Check out the modal desig ...

Styling images side by side with CSS in Internet Explorer

I've encountered a CSS dilemma. I have a collection of images that I want to present side by side using an unordered list within a fixed width container. The goal is to have 3 images per row before moving on to the next set of 3 images. Each list ite ...

Utilizing the CSS REM unit to define element dimensions

I recently discovered the versatility of using the REM unit for sizing elements, not just font sizes. It works really well in conjunction with the HTML font-size property. html { font-size:1vw } @media all and (max-width:720px) { html { font-size:10px ...

Having trouble running the npm script due to a multitude of errors popping up

I have encountered an issue while trying to run an npm script. I added the script in the `package.json` file multiple times, but it keeps showing errors. I am currently working on building a website and require npm sass for it. However, when I try to run t ...

What is the best way to display cards next to each other on desktop and mobile devices while maximizing available space?

In the world of React components, there exists a card representation within a grid view that adapts based on available screen space; function EngineerCard(engineer: EngineerDetail) { return ( <div className='engineerCard'> <d ...

Embracing Elegance with jQuery

Is there a way to customize the appearance of my list (<ul>) in the following code snippet? $.widget( "custom.catcomplete", $.ui.autocomplete, { _renderMenu: function( ul, items ) { var self = this, currentCategory = ""; ...

Show a 1920x1170 / 183KB image as the background using CSS styling

I need help with displaying a background image that is 1920x1170 pixels and has a file size of 183KB. Here is the code I am using: .bground{ height:auto; left:0; position:fixed; top:0; width:100%; } <div class="bgrou ...

Links are unable to function properly outside of the carousel slideshow in Chrome

www.encyclopediasindhiana.org/index2.php I successfully implemented a slideshow using mycarousel with the help of PHP. However, I am facing an issue where the hyperlinks on the left side of the carousel are not working if the image is as large as the heig ...

How come the centering of a text input field in an HTML form is proving to be so difficult using the text-align: center property?

Learning HTML has been quite the journey for me. One challenge I have faced is trying to center a search bar on my web page. Despite hours of searching and trying different tutorials, I still haven't been able to make it work. The CSS rule text-align ...

Full scale intricate grid arrangement

Is there a way to make this header 'full width' so that the image appears on the left side of the screen while keeping the content in the grid? https://i.sstatic.net/U6pft.png I was considering creating a new container. .container--full { max- ...

The <body> tag is not located at the top of the webpage

Recently, I've come across an interesting issue on my website. The scrollTo() method in jQuery seems to be working fine in Firefox, but it doesn't scroll to the top in Chrome. I suspect that the placement of the <body> tag might be causing ...

Tips for creating a responsive image using CSS

I am experiencing an issue with resizing a gif that I am trying to display on my screen. Here is the code snippet: import broomAndText from './ezgif.com-video-to-gif-3.gif'; import './spinner.css'; function myGif() { return < ...

Basic parallax application, failing to achieve the desired impact

My goal is to create a scrolling effect where the header text moves down slightly, adding some margin on top to keep it in view. I found the perfect example of what I want to achieve with the header text at this website: After spending hours working on i ...

Navigate to the most recent entry in the array while using ng-repeat

I am attempting to implement scrolling to the last added entry within an ngRepeat directive. After researching related questions on Stack Overflow, such as #1 and #2, I still cannot find a solution to my problem. The code is straightforward. When a user ...

Ways to display distinct text boxes based on selected radio button?

Currently, I am working with JSP and have implemented an HTML form that includes a "Process" button at the top. When this button is clicked, it displays a form with two radio buttons - TestClient and TestServer. The form also contains a Submit button. If ...

Tips for utilizing the div tag in a similar manner as a table

How can I position the div tag to resemble a table in the correct order? <html> <head><title> .</title> <link rel="stylesheet" type="text/css" href="style/main.css"/> <script type="text/javascript" src="script/ajax.js"& ...

Enlarge the DIV element along with its contents when those contents have absolute positioning

When attempting to overlay two divs like layers of content, I encountered a challenge. Because the size of the content is unknown, I used POSITION:ABSOLUTE for both divs to position them at the top left of their container. The issue: The container does no ...

Arranging items in a flex container

My goal is to achieve the following layout with flexbox: #box { display: flex; flex-wrap: wrap; flex-direction: row; justify-content: center; justify-items: center; align-items: center; } #spotLight img { width: 15%; height: 15%; } # ...

extended image in a bootstrap carousel

Having an issue with Bootstrap 4 carousel images getting stretched. Not sure what the problem is. .carousel { margin-bottom: 4rem; position: relative; } .carousel-caption { bottom: 3rem; z-index: 10; } .carousel-inner img { position: absolut ...