Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Style dropdown on datalist element

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #248584
    leorapirap
    Participant

    How can I style or replace the dropdown arrow in datalist?
    Please I badly need help.

    #248586
    I.m.learning
    Participant
    #248587
    leorapirap
    Participant

    Yep. I have read that answer but it is for hiding the dropdown arrow and not styling it. Can you please show me how to do it? Much appreciate it.

    #248591
    I.m.learning
    Participant

    Can you provide some code/link/demo/pen/anything to help us help you? Without something it’s a guessing game.

    #248594
    leorapirap
    Participant

    Here is the code sample. :)
    https://codepen.io/leorapirap/pen/ZBrBMx

    #248598
    Beverleyh
    Participant

    I have read that answer but it is for hiding the dropdown arrow and not styling it.

    Have you tried not hiding it, but styling it instead? Background/color etc.

    Or how about positioning an element/pseudo element over the top of the arrow and styling that any way you want. Also include pointer-events:none; so that clicks/taps pass through the fake arrow to the real arrow underneath.

    Unfortunately I’m not in a position to demo anything because datalist isn’t supported in Safari, and I’m on iPhone at the mo. I’m sure you can attempt something from my description in order to run tests though.

    #248735
    leorapirap
    Participant

    Thanks for your answer. I haven’t figure out how to style the down arrow on the data list element and thanks for mentioning that it is not supported in safari because I haven’t tested it there. Cheers!

    #248736
    I.m.learning
    Participant

    Add a background image.

    input[placeholder]{background-image:url() ;
    background-size: 15px 20px;
    background-position:right;
    padding:10px;
    background-repeat:no-repeat;
    }

    #248738
    Beverleyh
    Participant

    Unfortunately a background-image would still allow the default arrow to be visible over the top.

    I still think a pseudo element is the way to go – something like this http://codepen.io/anon/pen/xRjzKg
    The default arrow is still there, its just obscured by the faux arrow, and pointer-events allow the click/tap to pass through.

    Note that the faux arrow will be visible in those browsers that don’t support datalist so you’d need to compensate for that. http://caniuse.com/#search=datalist

    #248740
    leorapirap
    Participant

    Oh thanks! I’ll take note of that one. :)

    #248741
    leorapirap
    Participant

    Thank you :)

    #248742
    I.m.learning
    Participant

    I was wondering what arrow you were talking about. It wasn’t until I grabbed my phone that I actually saw one. Let me ask, what’s the difference between data list and a regular drop down?

    #248743
    leorapirap
    Participant

    You can actually type into the data list(a textfield) and search the list of options while the regular dropdown can’t.

    #248744
    Beverleyh
    Participant

    what’s the difference between data list and a regular drop down?

    Google is your friend…

    Short answer:
    Datalist = suggestions along with open text entry
    Select = prepopulated list of options

    #248757
    I.m.learning
    Participant

    I didn’t have time to Google. So I figured I’d ask here.

Viewing 15 posts - 1 through 15 (of 19 total)
  • The forum ‘CSS’ is closed to new topics and replies.