CSS – short for Cascading Style Sheets – is a “programming language” you use to turn your raw HTML pages into real beautiful websites.
Clip-path property is your ticket to shape-shifting the monotonous, boxy layouts traditionally associated with flat, responsive design. You will begin to think outside the box, literally, and hexagons, stars, and octagons will begin to take form on your web pages. Once you get your hands dirty with clip-path, there’s no end to the shapes you can generate, simply by tweaking a few values. While the focus of this article is on clip-path using polygons with CSS, all of the demos provide a reference to an inline SVG, in order to gain additional support on Firefox. Generating a responsive SVG clipped shape is trivial once you have created a responsive shape with CSS’ clip-path. We’ll look at this in detail later.
clip-path makes it easy to clip-out basic shapes using either of the polygon, ellipse, circle, or inset keywords, which are part of the CSS exclusion module.
Polygon is the most flexible of all the available shapes because it allows you to specify any amount of points, a little bit like an SVG path. The provided points are pairs of X and Y coordinates that can be of any unit (eg: pixel or percent-based). Because it’s the most flexible, it’s also the most complex and you’ll probably want to use a tool to define your points.
Clipping is when we trim a piece from something. In our case, it is an operation that allows us to completely or partially hide elements on a web page. Two other concepts that relate to clipping which we will use in this article are the clipping path and clipping region.
The clipping path is the path we use to clip an element, it marks out our clipping region. It can be a basic shape or a complex polygonal path. The clipping region then includes all the area enclosed within the clipping path.
Anything outside the clipping region is clipped by the browsers. This not only includes backgrounds and other such content but also borders, text-shadows, and so on. Moreover, browsers won’t capture any events like hover or click outside an element’s clipping region.
Even though our specific element is now non-rectangular, the content around the elements flows exactly the way it would have if the element had its original shape. To make the surrounding elements flow according to the shape of the clipped element, you will have to use the shape-outside property.
This is a video course full of real downloadable code examples. You’ll be able to take the knowledge, as well as the real working code, to your projects and make sure they stand out.
Help and inspiration?
Not only do you get a load of practical, useful starting projects in this course, you can also head over to CSS Animation.rocks for more, and even sign up to a weekly newsletter packed full of tutorials, inspiration, and tips for animating on the web.
There’s no better time to learn Animations: You’ve made a smart choice because CSS 3 Animations is the most popular language out there. This is no exaggeration. This popularity and growth mean more jobs and opportunities than ever before.
Get access to fast support if you get stuck: There’s nothing worse than getting stuck ten hours into a course and not getting the help you need to continue. Getting stuck is part of the learning process. That’s why I’m here to answer every single question that comes my way.
I guarantee that this is the most up-to-date and engaging course available, and it comes with a Udemy 30-day money-back guarantee.
I can’t wait to see you on the inside!
– B. Praveen Kumar ( PHP Developer & Web Designer – FULL Stack Developer ).