1659859740
Il existe 2 manières principales de créer un triangle en CSS : en utilisant des bordures ou un chemin de clip .
Cette méthode est la plus éprouvée et est prise en charge par pratiquement tous les navigateurs. Voici comment procéder : Choisissez un élément,
<div class="triangle"></div>
et appliquez une bordure épaisse de chaque côté en utilisant une couleur différente. 🎨
.triangle {
width: 0;
height: 0;
border-bottom: solid 50px red;
border-top: solid 50px green;
border-left: solid 50px blue;
border-right: solid 50px yellow;
}
Chaque bordure ressemble à un triangle
En faisant cela, vous obtenez 4 triangles ! La clé est d'avoir un élément réduit , c'est-à-dire sans largeur ni hauteur. Bien sûr, vous voulez qu'un seul triangle soit visible, alors vous rendez simplement les autres transparents . C'est parti pour le vert ! 🟢
.triangle {
...
border-bottom: solid 50px transparent;
border-top: solid 50px green;
border-left: solid 50px transparent;
border-right: solid 50px transparent;
}
Triangle utilisant une seule bordure
Syntaxiquement, clip-path
est plus facile à écrire et à maintenir. Cependant, sa prise en charge dans les anciens navigateurs peut faire défaut.
La polygon
forme géométrique prend n'importe quelle quantité d'arguments . Chaque argument 💬 représente un coin de votre forme et prend 2 valeurs : x et y.
.triangle {
width: 100px;
height: 100px;
background-color: red;
clip-path: polygon(50% 0, 0 100%, 100% 100%);
/* polygon(1[x y], 2[x y], 3[x y]) */
}
Triangle utilisant le chemin de découpe
Les coordonnées peuvent être exprimées dans n'importe quelle unité, par exemple %
, px
, em
, etc. Je vous recommande de consulter cet impressionnant générateur de chemin de découpe chaque fois que vous souhaitez créer une forme à l'aide de clip-path
.
1596530868
Want to develop a website or re-design using CSS Development?
We build a website and we implemented CSS successfully if you are planning to Hire CSS Developer from HourlyDeveloper.io, We can fill your Page with creative colors and attractive Designs. We provide services in Web Designing, Website Redesigning and etc.
For more details…!!
Consult with our experts:- https://bit.ly/3hUdppS
#hire css developer #css development company #css development services #css development #css developer #css
1603188000
The other day one of our students asked about possibility of having a CSS cheatsheet to help to decide on the best suited approach when doing this or that layout.
This evolved into the idea of making a visual CSS cheatsheet with all (most) of the common patterns we see everyday and one of the best possible conceptual implementation for them.
In the end any layout could and should be split into parts/blocks and we see every block separately.
Here is our first take on that and we would be happy to keep extending it to help us all.
Please, send you suggestions in the comments in community or via gitlab for the repeated CSS patterns with your favourite implementation for that so that we will all together make this as useful as it can be.
#css #css3 #cascading-style-sheets #web-development #html-css #css-grids #learning-css #html-css-basics
1659859740
Il existe 2 manières principales de créer un triangle en CSS : en utilisant des bordures ou un chemin de clip .
Cette méthode est la plus éprouvée et est prise en charge par pratiquement tous les navigateurs. Voici comment procéder : Choisissez un élément,
<div class="triangle"></div>
et appliquez une bordure épaisse de chaque côté en utilisant une couleur différente. 🎨
.triangle {
width: 0;
height: 0;
border-bottom: solid 50px red;
border-top: solid 50px green;
border-left: solid 50px blue;
border-right: solid 50px yellow;
}
Chaque bordure ressemble à un triangle
En faisant cela, vous obtenez 4 triangles ! La clé est d'avoir un élément réduit , c'est-à-dire sans largeur ni hauteur. Bien sûr, vous voulez qu'un seul triangle soit visible, alors vous rendez simplement les autres transparents . C'est parti pour le vert ! 🟢
.triangle {
...
border-bottom: solid 50px transparent;
border-top: solid 50px green;
border-left: solid 50px transparent;
border-right: solid 50px transparent;
}
Triangle utilisant une seule bordure
Syntaxiquement, clip-path
est plus facile à écrire et à maintenir. Cependant, sa prise en charge dans les anciens navigateurs peut faire défaut.
La polygon
forme géométrique prend n'importe quelle quantité d'arguments . Chaque argument 💬 représente un coin de votre forme et prend 2 valeurs : x et y.
.triangle {
width: 100px;
height: 100px;
background-color: red;
clip-path: polygon(50% 0, 0 100%, 100% 100%);
/* polygon(1[x y], 2[x y], 3[x y]) */
}
Triangle utilisant le chemin de découpe
Les coordonnées peuvent être exprimées dans n'importe quelle unité, par exemple %
, px
, em
, etc. Je vous recommande de consulter cet impressionnant générateur de chemin de découpe chaque fois que vous souhaitez créer une forme à l'aide de clip-path
.
1618024175
CSS is seen as an impediment in web development for many of us. Most of the time it looks like even when you follow the rules and everything seems clear, it still doesn’t work the way you want it to.
Therefore, the purpose of this article is to make some features of CSS much easier to understand.
The thing I want to address now is the alignment of the elements.
Without further ado, here are some of the most common scenarios one might encounter when it comes to this topic and how they can be approached.
#css-center #css-position #css-flexbox #css-center-image-in-a-div #css
1617932400
This effect is so cool and just fun to see. What it comes down to is having a background image show through the text.
How it works is that we will have a div that will have the image as a background. On that, we put our text element, using blend-mode it will show through the image.
The result you can see and touch on this Codepen.
#css #css3 #html-css #css-grids #learning-css #html-css-basics