mirror of
https://github.com/phuoc-ng/csslayout.git
synced 2025-09-09 22:00:53 +02:00
feat: Inverted corners
This commit is contained in:
2
contents/_includes/patterns/inverted-corners.njk
Normal file
2
contents/_includes/patterns/inverted-corners.njk
Normal file
@@ -0,0 +1,2 @@
|
||||
<div class="inverted-corners">
|
||||
</div>
|
@@ -163,6 +163,12 @@ eleventyExcludeFromCollections: true
|
||||
<div class="pattern__title">Initial avatar</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="pattern__item">
|
||||
<a class="pattern__link" href="/inverted-corners/">
|
||||
<div class="pattern__cover">{% include "patterns/inverted-corners.njk" %}</div>
|
||||
<div class="pattern__title">Inverted corners</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="pattern__item">
|
||||
<a class="pattern__link" href="/triangle-buttons/">
|
||||
<div class="pattern__cover">{% include "patterns/triangle-buttons.njk" %}</div>
|
||||
|
52
contents/inverted-corners.md
Normal file
52
contents/inverted-corners.md
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
layout: layouts/post.njk
|
||||
title: Inverted corners
|
||||
description: Create inverted corners with CSS
|
||||
keywords: css border radius, css inverted border radius, css inverted corners
|
||||
---
|
||||
|
||||
## HTML
|
||||
|
||||
```html
|
||||
<div class="inverted-corners">
|
||||
...
|
||||
</div>
|
||||
```
|
||||
|
||||
## CSS
|
||||
|
||||
```css
|
||||
:root {
|
||||
--inverted-corners-background: #d1d5db;
|
||||
--inverted-corners-size: 2rem;
|
||||
}
|
||||
|
||||
.inverted-corners {
|
||||
background-color: var(--inverted-corners-background);
|
||||
|
||||
/* Used to position the corner */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.inverted-corners::before {
|
||||
content: '';
|
||||
|
||||
/* Absolute position */
|
||||
bottom: calc(-2 * var(--inverted-corners-size));
|
||||
left: 0;
|
||||
position: absolute;
|
||||
|
||||
/* Size */
|
||||
height: calc(2 * var(--inverted-corners-size));
|
||||
width: var(--inverted-corners-size);
|
||||
|
||||
/* Border */
|
||||
background-color: transparent;
|
||||
border-top-left-radius: var(--inverted-corners-size);
|
||||
box-shadow: var(--inverted-corners-background) 0px calc(-1 * var(--inverted-corners-size)) 0px 0px;
|
||||
}
|
||||
```
|
||||
|
||||
{% demo %}
|
||||
{% include "patterns/inverted-corners.njk" %}
|
||||
{% enddemo %}
|
Reference in New Issue
Block a user