HTML Multi-Column List Box

Can a List Box be created with List Items displayed in Multiple Columns? I know there are other options available, but I'm curious if this is achievable using the <select> tag

Answer №1

Incorrect. Select tags only allow option as a child tag, and option can only contain plain text (although some browsers may support certain style tags like b or i).

Answer №2

One potential approach I have in mind involves utilizing a fixed-width font for the list dropdown and then padding the content columns with spaces.

 ITEM1_NAME        |  ITEM2_NAME
 A value           |  Another value
 Another value     |  Second item

Another option is to experiment with "OPTGROUP" elements for the column names, but be mindful of possible variations in rendering across different browsers.

Update: To illustrate, you could create a "multi-column" dropdown similar to this example: using the following HTML code

<style type="text/css">* {font-family:Courier New;white-space:pre;}</style>
<select>
  <option></option>
  <optgroup label="      Col1              | Col2">
    <option>Some nice value   |  Another value</option>
    <option>Another nice value|  Second column</option> 
  <optgroup>
</select>

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

Using ng-if in AngularJS to compare two objects

I am transferring between controllers with different formations, and I am attempting to use "ng if" to compare the ids, but it is not functioning as expected. Below is the code snippet: var postsApi = 'http://mywebsite.com/wp-json/posts?filter[p ...

Java: Issue with JLabel Text Alignment

At the bottom of my panel, I have a JLabel that provides text instructions to the user. When some of the text exceeded the screen width, I used tags to fix this issue. However, after implementing the code shown below, the text is no longer centered an ...

After updating to Chrome version 65, I noticed an unexpected error popping up: The onClick listener was expected to be a function, but instead, it

I recently encountered an error in my React app that has been causing some issues. https://reactjs.org/docs/error-decoder.html?invariant=94&args[]=onClick&args[]=string Minified React error #94: Expected onClick listener to be a function, instea ...

Convert a JSON Object using AngularJs

Is there a method in Angular to restructure this JSON Object? I am looking to convert the JSON object from its original format: $scope.TestJson = { "filters": [ { "dataPropertyID": "VoidType", ...

Converting a class with two lists into an MVC 4 controller with Ajax functionality

Recently, I attempted to send a class with two lists via ajax to an MVC controller. Here is the code for the MVC Controller: [HttpPost] public JsonResult AfficherDetailsFacture(AfficheDetails afficheDetailsFacture) { // do some stuff } Below is the ...

jQuery creates a <select> element with no value

I am having trouble creating a select element using jQuery and an array. Although I can see the options and select them, there is no active or selected value being displayed in the select area. Here is the code I am currently using: output = '&apo ...

Cease the continuous scrolling of the display element now

I'm having trouble with my progressbar animation when scrolling. It seems to run multiple times instead of just once. I apologize if there's an error in my code. Could someone please assist me? This is the code I am using: <div class="demo- ...

Adjusting offcanvas height in Bootstrap based on content

.cursor-pointer { cursor: pointer; } <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="690b06061d1a1d1d09c13c809e9afbcfc1792efeff8">[email protected]</a>/dist/js/bootstr ...

Connect the input field to a dictionary

Here is an input field: <input id="DeviceId" class="form-control deviceCatalog" data-bind="value:DeviceTemp, valueUpdate: ['blur']" required /> This input is connected to the following viewModel: var ViewModel = f ...

Using async-await to handle an array of promises with the map method

I have come across several discussions on the same error but none of them solved my issue. Here is the code I wrote: const userOrganizationGroups = (organizationGroupsList) => { if (Array.isArray(organizationGroupsList) && organizationGroupsLi ...

Having trouble retrieving a response from my Symfony2 controller using AJAX, any suggestions on how to solve this issue?

After implementing a signin form that submits values through ajax successfully, I realized that regardless of whether the values match those in the database or not, I always receive a 200 status response from my controller. This makes it difficult to deter ...

Ensure that the vue-router guard waits for the completion of the axios API call in Vuex before proceeding

I am currently working with a django-rest-axios-vuejs application stack, and I have a specific task that involves the vue-router. Within the beforeEach guard of the vue-router, I am checking permissions by verifying something in the me object within the v ...

Events are documented as being removed when new content is introduced

In order to enhance user experience during long operations in my application, I am experimenting with adding a loading animation specifically on the login screen. To achieve this, I am utilizing code snippets that involve using IRazorViewEngine and ITempDa ...

Dynamic Display Picture Banner - Adjustable Layout

My home page features a full screen image header that I'm working to make responsive. The width of the image is being cut off on various screen sizes. I've attempted adjusting the height and width settings, but I want the image itself to resize ...

Issues with the alignment of columns using Bootstrap framework

I've created a design in Photoshop using the Bootstrap 12-column guide, but when I try to implement it using Bootstrap, the results are completely off. https://i.stack.imgur.com/vQwOt.png Here's my HTML code: <!DOCTYPE html> <html lan ...

Utilize a Material UI GridList to transform images into a captivating background display

Incorporating a GridList displaying a variety of images fetched from an external source, I have successfully created an ever-changing image gallery. Now, my goal is to convert this dynamic image gallery into grayscale or transparency and utilize it as a ba ...

What is the reason behind the non-exportation of actions in Redux Toolkit for ReactJS?

Currently, I am utilizing @reduxjs/toolkit along with reactjs to create a shopping cart feature. However, I am encountering an issue when attempting to export actions from Cart.js and import them into other files like cart.jsx and header.jsx. The error mes ...

Encountering difficulties accessing Node.JS Sessions

Hey there, I am currently working on integrating an angular application with Node.js as the backend. I have set up sessions in Angular JS and created my own factory for managing this. Additionally, I am utilizing socket.io in my Node.js server and handling ...

searchByTextContentUnderListItemAnchorTag

I would like to utilize the getByRole function for writing my test. However, I am encountering issues when using linkitem or 'link' as the role. It seems that I cannot find the desired element. // encountered error TestingLibraryElementError: The ...

### Setting Default String Values for Columns in TypeORM MigrationsDo you want to know how to

I'm working on setting the default value of a column to 'Canada/Eastern' and making it not nullable. This is the current setup for the column: queryRunner.addColumn('users', new TableColumn({ name: 'timezone_name', ...