- This topic is empty.
-
AuthorPosts
-
March 12, 2018 at 8:21 am #268175
susanlitton
ParticipantHi all,
I used to be able to use styles like the ones below – they worked just fine. However, in newer browsers, neither the positioning nor the cursor styles seem to work. I can only change color. What’s the story on this? Is there a workaround?
Here’s what used to work:
#view_sessions_participant_select option, #participant_select option {
margin-left:15px;
}#view_sessions_participant_select option[value=”all”], #view_sessions_participant_select option[value=”0″], #participant_select option[value=”-1″], #participant_select option[value=”0″] {
margin-left:3px;
}#view_sessions_participant_select option[value=”all”] {
color:#d26d13;
cursor:pointer;
}March 12, 2018 at 8:46 am #268176Paulie_D
MemberWithout the actual code in a minimal demo we can’t really comment.
March 12, 2018 at 9:28 am #268178susanlitton
ParticipantI don’t have a Code Pen account but can get one if necessary. I just thought maybe someone would know right off if styling options based on value was still possible and/or if there’s a workaround. You can still do color – but not margin, padding or cursor.
I also haven’t checked this in an older browser emulator to make sure it’s a browser issue. I just know this type of styling used to work in an app I’m building and it doesn’t now.
I’m at work – don’t have time to set up a proper demo but will do so later.
Thanks.
March 12, 2018 at 9:31 am #268179Paulie_D
MemberYou don’t need a full account with Codepen, it’s free to use.
March 12, 2018 at 10:24 am #268180susanlitton
ParticipantOk, great. I’ll work up a demo when I get off work. Thanks for the info.
March 13, 2018 at 8:33 am #268211susanlitton
ParticipantOk, here’s the Pen for this. I added an h1 and a div just so I could make sure things were working but the part I’m interested in is whether or not there’s a way to style the options with the value attribute. It worked great in older browsers but doesn’t seem to have any effect in newer ones. Sometimes I can get a color style to work but I tried adding color to several of these and even that isn’t working.
What I’m trying to accomplish is that many of our dropdown options have links in them. I’d like to have them styled like other links in the site so they’re easily recognizable by users.
March 14, 2018 at 5:27 am #268236Paulie_D
MemberSeems it’s not possible any more
https://stackoverflow.com/questions/16344583/style-select-element-based-on-selected-option
March 14, 2018 at 7:39 pm #268274susanlitton
ParticipantThat’s what I was afraid of, but it’s a real shame. It’s such a userful thing to be able to do to improve user experience and was nice to do it with CSS.
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.