Customize Dropdown
Question

Hi,
I am using the dropdown in reactive, I want to show the first 5 dropdown values background color green in dropdown values, Its possible?


Thanks,

Nave

mvp_badge
MVP

Hi Nave,

Yes you can do that with some extra CSS.

Regards,

Daniel

select option:first-child,
select option:nth-child(2),
select option:nth-child(3),
select option:nth-child(4),
select option:nth-child(5)
{
    background-color: green;
    color: white;
}

Hi Daniel,
Thank you for the reply, Can you pls share the oml. First 5 values are not constant, It will change based on the conditions, Sometimes Number of values are increase or decrease.

Thanks,
Nave

mvp_badge
MVP

Hi Nave,

There is not much more to share than I did. If you apply the above CSS, as on your request the first 5 entries in the dropdown have a different background color. No other change is made to dropdown to get this behavior. The CSS is not dependent of the values, its the first 5 positions in the list that are effected.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.