Jump to content

How do you change option background color of clicked option in drop-down?


Recommended Posts

Hi @JaredL,

Options (attributes of the dropdown)  of  an html “select” element can be styled, however very minimally, as the styling for these elements is handled by the user's OS. 

Background-color, color and font-weight can be changed for the option elements, for example:
 

select option {
    background-color: green;
    font-weight: bold;
    color: red;
}



 

Link to comment
Share on other sites

Hi @JaredL,

You can add it into the Header after disabling HTML editor on th Advanced tab:


 

<style>
select option {
    background-color: green;
    font-weight: bold;
    color: red;
}
</style>

or you can add the code into the User-defined styles in to the Styles menu:
 

select option {
    background-color: green;
    font-weight: bold;
    color: red;
}

 

Link to comment
Share on other sites

  • 2 weeks later...

Hi- If you plan to put the style in your DataPage please make sure that you add !important syntax so that the style that you set will be prioritize.

The !important property in CSS is used to provide more weight (importance) than normal property. In CSS, the !important means that “this is important”, ignore all the subsequent rules,

Example: 

<style>
select option {
    background-color: green!important;
    font-weight: bold!important;
    color: red!important;
}
</style>
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...