Circular-edged side menu

Angwalt
2 min readJan 29, 2020

--

Using the clip-path property

Have you seen those beautiful side slide-in menus that have interesting shapes for example circular, triangular or even various forms of polygons?

Well, I can bet that most of them have been created using the clip-path CSS property and that’s what we’ll be looking at today.

Unfortunately, as per MDN here the support for this particular property and its various use-cases such as animations, use on paths and HTML elements is not yet very robust, but that should never stop anyone with experimenting. I do as a result recommend using them with various fall-backs in production to ensure a favourable user experience in case your page is opened on a browser that does not support the property fully.

Nonetheless, in order to achieve the aesthetically pleasing circularly edged slide-in menu. All you need to manipulate is the menu by setting its position as absolute relative to the body element and set its clip-path property to circle with an appropriately-sized radius which is the parameter value you pass to circle.

clip-path:circle(40px);

At this point,you can use any of the other values available aside from circle such as ,polygon or path to achieve other interesting shapes. But to achieve the slide-in animation you can simply use transform to translate on the X axis till the menu is out of view and you can have a button to toggle it back and forth with a transition-duration to smooth the movement.

To see a working version of this , checkout the codepen below and keep experimenting!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Angwalt
Angwalt

Written by Angwalt

Just another coder like you

No responses yet

Write a response