Clip-Path and border

1

1

1

The clip-path() property

Clip-path() is a CSS property to cut a geometrical region from a region:

We use circle( radius, center ):

//we can use % and px for the center, 50% takes the entire space
.circolo{
    background-color: red;
    clip-path: circle(40% at 20% 75% );
}
clip circle on different center

We can have border-radius on inset clips:

chevron-rightBorder radius exampleshashtag

Unlike inset() that can take 2 values max, we can use up to 4 with border-radius:

inset with border radius

We can clip entire polygon(), you can use this as a guidearrow-up-right:

We draw (X,Y) points for each point of the polygon:

star polygon on gradient

CSS borders and border-box

Using the border property we can specify width, color and style of a border

chevron-rightBorders guidehashtag

About border-style:

We can style/width each side of the border

border examples

We can use border-style: double or the outline property for a double border:

chevron-rightBorder: double and Outline guide hashtag

The width of border-style: double is equally divided:

The outline property draws a line outside the border.

It shared properties with border but can't use border-radius, it can conflict with margin:

Outline-offset is not in the shortcut and can be negative:

border-style double and outlines

For an internal border, we can use :before:after, box-shadow, or background-clip:

We space each side:

after layer on the relative

The border width sets the difference between content-box and border-box:

border-box and content-box

We use border-images to use gradients or url images for our borders:

chevron-rightBorder-image guidehashtag

We can't use the shorthand for images/gradients:

background-images

We can't use border-radius not border-left/right/top/bottom for border-image but:

chevron-rightBorder image radius guidehashtag

We can use padding-box and border-box background:

We could use border-image-slice to cut borders:

Or cut specific border-width:

It works the same for border-radius:

different border-image styles

1

Last updated