Creating a sleek appearance for Bootstrap input within the selectize.js component by mimicking the input-sm

I am currently working with a selectize component that appears like this: https://i.sstatic.net/z2aTw.png

My objective is to adjust the appearance of the search input to make it smaller by changing its class from the standard bootstrap input to input-sm. I believe I need to modify the source code, but I am unsure of where and how to do this. Can you please assist me with this? I have been trying to address this issue intermittently for the past four months.

JS:

vendors_name_selectize = $('#vendors_name_input').selectize({
            maxItems: 100,
            preload: true,
            openOnFocus:true,
            valueField: 'value',
            labelField: 'text',
            searchField: ['text', 'inn', 'kpp'],
        })[0].selectize;

HTML:

<th style='width:20%' class='vendor_list_official_name'>
                        <div class="input-group zeon-column-search">
                            <div class="dropdown">
                                <button type="button" data-toggle="dropdown">
                                    Название
                                    <span class="caret"></span>
                                </button>
                                <div class="dropdown-menu zeon-dropdown-wide">  
                                    <select id="vendors_name_input" placeholder="Поиск">
                                    </select>
                                </div>
                            </div>
                        </div>
                    </th>

On another note, there is no need to create a JSFiddle since the size of the input there differs from what I am seeing in my application.

Answer №1

The input is enclosed within a container that includes padding and a border. The input itself has its CSS properties reset by selectize.default.css (although this may vary for other selectize themes). However, you have the ability to adjust the height of the element using the following CSS:

.selectize-input { padding: 0; }

Moreover, you can decrease the font size of the input to further reduce its height:

.selectize-input>input { font-size: 10px; }

Feel free to use !important if necessary. The CSS should function correctly if it's cascaded appropriately.

DEMO

// bootstrap 3.3.6
// jquery 2.2.1
// fontawesome 4.5.0

vendors_name_selectize = $('#vendors_name_input').selectize({
  maxItems: 100,
  preload: true,
  openOnFocus: true,
  valueField: 'value',
  labelField: 'text',
  searchField: ['text', 'inn', 'kpp'],
})[0].selectize;
.open>.dropdown-menu { padding: 0.5em; }

.selectize-input { padding: 0 !important; }

.selectize-input>input { font-size: 10px !important; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.2/js/standalone/selectize.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.2/css/selectize.default.min.css" rel="stylesheet"/>

<th style='width:20%' class='vendor_list_official_name'>
  <div class="input-group zeon-column-search">
    <div class="dropdown">
      <button type="button" data-toggle="dropdown">
        Название
        <span class="caret"></span>
      </button>
      <div class="dropdown-menu zeon-dropdown-wide">
        <select id="vendors_name_input" placeholder="Поиск">
        </select>
      </div>
    </div>
  </div>
</th>

jsFiddle: https://jsfiddle.net/azizn/dh725pd3/

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

jQuery tooltip anchored to the left side of the screen, ignoring all attempts to adjust its position

I have a jQuery tooltip that is supposed to hover over the table header, but it is displaying on the far left side of my screen with no formatting - just black text. I have attempted to use the placement and position jQuery attributes, but they do not seem ...

I am encountering issues with an HTML table that is in need of fixing, and I must find a solution without relying on

Can someone help me troubleshoot the structure of this table in the given image? It seems like my rowspan and colspan attributes are not working as expected. I've only used CSS to specify the width and height of the cells. https://i.sstatic.net/VtHbH ...

How to activate a function or event upon closing a browser tab with JavaScript

How can a function be triggered when a user closes the browser tab, preventing it from closing immediately and instead displaying a popup prompting the user to either proceed to another page or close the tab? Scenario: In the event that a user attempts t ...

How can I ensure that the content within a div does not overflow and that horizontal scrolling is enabled? What is the correct way

After designing my profile page, I encountered a problem related to horizontal scrolling caused by overflow. Despite trying various solutions like adjusting the width of .profilePg, I haven't been able to resolve this issue without disrupting the over ...

Implementing Angular CDK for a dynamic drag-and-drop list featuring both parent and child elements

I'm currently working on setting up a drag and drop list within Angular using the Angular CDK library. My goal is to create a list that includes both parent and child elements, with the ability to drag and drop both parent items as well as their respe ...

My header has a video background that appears aesthetically pleasing on a desktop screen. However, when viewed on a mobile device, it is off-center and doesn't span the full

I am having an issue with a header that has a video background. It looks great on desktop, but on mobile devices, it is only taking up about 2/3 of the screen width and is aligned to the left side instead of filling the entire width. I have tried several ...

To emphasize code in an HTML document, you can use the <font color="#xxx"> tag

Can anyone guide me on how to add color highlights to my HTML code in this way? <font color="#1773cc">#include </font><font color="#4a6f8b">&lt;NTL/ZZ.h&gt;</font><br> <br> <font color=&quo ...

Monitoring WooCommerce order submissions through AJAX

I'm exploring the world of Ajax for the first time. My goal is to submit an order tracking form and show the results using AJAX. I attempted to use Ajax to display the results within div track_result. The issue I'm facing is that the following ...

Switching ng-Idle countdown time from seconds to minutes is possible by adjusting the configuration settings

I have implemented ng-idle in my application, where the warning popup appears after 10 seconds with the message: "Your session will be close in 10 seconds" However, I need to change this to minutes. The session should be closed in 5 minutes instead. How ...

Is there a way to access the variable value chosen from a select dropdown inside a function and then assign it to a JavaScript variable outside of the function?

Below is the HTML and JavaScript code that I am working with: function changeResult() { x = document.getElementById("dropdown-list").value; console.log((x)); } var qq; <select id="dropdown-list" onchange="changeResult()"> <option value="4 ...

The drop-down menu is malfunctioning as it is not displaying the complete text and the

At the moment, I am facing an issue where my submenu items for Add Subject, Drop Subject, and Delete Subject are not centralized as intended. Additionally, the Executive Summary text in the submenu is getting cut off. Can someone please help me with expand ...

The layout generated by Metronic does not display the CSS styles

I've been working on creating a Metronic layout using the layout builder, but I'm running into an issue. Whenever I try to open index.html, all I see is this: screenshot It appears that the CSS styles are not loading properly. Interestingly, wh ...

Arranging 2 divs side by side

As a beginner, I'm struggling to find the answer because I have no idea what search terms to use. Now, I have a form <form action="#" method="POST"> <div id="labels"> <label>CMS System</label><p> ...

Styling group headers within an unordered list using pure CSS - possible?

Hey there, I'm looking to spruce up my UL by adding group headers. Here's a sneak peek at the structure I have in mind (keep in mind this is generated dynamically from a database): <ul> <li class='group group-1'> < ...

The absence of the iframe in ie8 is causing problems that cannot be fixed with relative positioning

On a website, I am integrating an external 2-factor authentication solution called Duo Web using their PHP and Javascript. It works smoothly on all browsers except for IE8. When the user passes the initial login screen, the 2FA login page loads, but the if ...

What steps can I take to make sure Google Password Manager saves the accurate field as the username?

My Background Being a freelance web developer, I recently worked on creating a web app for a client who owns a successful meal-planning business. This web app was designed to help her clients easily access and view their personalized meal plans. The Issue ...

Resizing the width to fit truncated content

When displaying text within a span element inside a fixed-width structure, I want to use ellipsis if the text overflows. To show the full text, I have initialized a Bootstrap tooltip in these elements. However, the tooltip is visually misplaced due to the ...

The JavaScript code is failing to retrieve the longitude and latitude of the location on a mobile browser

I am having an issue with my Javascript code not properly retrieving the longitude and latitude from the mobile Chrome browser. While this code works fine on laptop or desktop browsers, it seems to be failing on mobile devices: <script> if (nav ...

Is nesting possible with the &:extend function in LessCss?

I've recently been exploring the Less &:extend feature. My goal is to nest multiple extends - essentially extending a class that itself extends another class. However, after testing it out, I'm not sure if it's working as expected. It ...

Why isn't my API's JSON Response showing up in PHP?

Having trouble displaying the JSON response from an API call in PHP. Despite confirming that the server, IP settings, and API status are all fine on the provider's end, I am unable to identify the problem. This is how I'm handling the PHP part: ...