Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdown doesn't open when adding pseudo elements in css #92

Open
MathRivest opened this issue Oct 17, 2014 · 2 comments
Open

Dropdown doesn't open when adding pseudo elements in css #92

MathRivest opened this issue Oct 17, 2014 · 2 comments

Comments

@MathRivest
Copy link

I wanted to add an arrow in css using :after. When I click the arrow, the dropdown doesn't open. Clicking anywhere else works as expected. Thanks

@deansimcox
Copy link

I'd say that your problem is that your psuedo element is above the transparent element. You can fix this by making sure that hat psuedo element has a lower z-index that the element.

@svinkle
Copy link

svinkle commented Jan 22, 2016

In case this helps anyone else, here's my solution for this:

  1. Wrap the select in a new div:

    <div class="customSelectContainer">
      <select>
      ...
      </select>
    </div>
  2. Then add these styles:

    .customSelectContainer {
      position: relative;
    }
    
    .customSelectContainer:before {
      content: "\25BE";
      height: 20px;
      line-height: 1;
      margin-top: -10px;
      position: absolute;
      right: 0;
      text-align: center;
      top: 50%;
      width: 40px;
      z-index: 2;
    }
    
    .customSelectContainer:after {
      background-color: #eee;
      border: #aaa solid 1px;
      bottom: 0;
      content: "";
      position: absolute;
      right: 0;
      top: 0;
      width: 38px;
      z-index: 1;
    }
    
    .hasCustomSelect {
      z-index: 3;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants