Hi there, I’m learning to write css for a site. I maded a dropdown menu with triangle. But that arrow skewed and I don’t know how to move it to center of that link. Thanks for your help <3
Hi @dung251997, could you post a link to the code or possibly a codepen/jsfiddle showing the issue?
wait a minute <3…
@dung251997, make sure your dropdown menu is absolute positioned relative to the link. Then it will be very easy to control position of your dropdown
I’m using sublime to code, but it’s got error when I paste on codepen
so the link should be relative ?
Yes, link relative and dropdown should be a child
As you might have multiple dropdown menus, I would suggest giving them unique ID, like explorerDropdown and explorerDropdownMenu, if you want to select them in CSS. In JS you don’t really need it, as they ‘will be selected by user’ on click event and you can do generic:
e.target.closest('.dropdown-menu').classList.add('open')
It looks like you use some sort of framework though, probably Bootstrap, that should do this for you I guess
Ok, thanks for you help