Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Add Arrow down into Flag Dropdown menu

i want to add arrow down into dropdown menu?

My current code in link:

https://jsfiddle.net/bvotcode/qe6L3bxr/1/

My CSS:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

.flagdropdown { position: relative; cursor: pointer; border: 0.5px solid gray; width: 110px; position: absolute; content: "▼"; left: 50%; top: 10%; transform: translate(-50%, 50%);}
.flagdropdown-options { position: absolute; width: 100%; z-index: 10; background: #fff; }
.flagdropdown-option { padding: 5px; }
.flagdropdown-option:hover { background-color: #f0f0f0; }
.flagdropdown-position-1 {object-position: 5px; top: 55%; border-radius: 0.25rem;}

Thank you
enter image description here

>Solution :

For this, you should use CSS-pseudo elements like before or after.
Moreover, use pointer-events: none on the pseudo-element so that it does effect the clicking function.

Look at this example:

.flagdropdown::after {
  content: '';
  position: absolute;
  top: 7px;
  right: 5px;
  width: 0px;
  height: 0px;
  border-top: 5px solid black;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid transparent;
  pointer-events: none;
}

Note: the borders are just to create the triangle shape of the arrow icon

Output:

enter image description here

Working jsfiddle:
https://jsfiddle.net/py2wdt1L/6/

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading